Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,31 @@ on:
branches:
- main

permissions:
contents: read

jobs:

typos:
name: Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
lfs: true
- uses: crate-ci/typos@master
- uses: crate-ci/typos@v1.51.1

cargo-shear:
runs-on: ubuntu-latest
needs: typos
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v7
with:
lfs: true

- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main
uses: cargo-bins/cargo-binstall@v1.26.0

- name: Install cargo-shear
run: cargo binstall --no-confirm cargo-shear
Expand All @@ -42,7 +45,7 @@ jobs:
runs-on: ubuntu-latest
needs: typos
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
lfs: true
- uses: EmbarkStudios/cargo-deny-action@v2
Expand All @@ -53,7 +56,7 @@ jobs:
needs: [cargo-shear, cargo-deny]

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
lfs: true
- uses: dtolnay/rust-toolchain@master
Expand All @@ -72,7 +75,7 @@ jobs:
needs: build

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
lfs: true
- uses: dtolnay/rust-toolchain@master
Expand Down Expand Up @@ -101,7 +104,7 @@ jobs:
needs: check

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
lfs: true

Expand Down
156 changes: 68 additions & 88 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,27 @@ jobs:
create-windows-binaries:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: actions/checkout@v7

- name: Install stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: Build git-statuses
run: |
cargo build --release

- name: Get the version
shell: bash
id: tagName
run: |
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "::set-output name=tag::$VERSION"
run: cargo build --release --locked

- name: Build package
id: package
shell: bash
run: |
ARCHIVE_TARGET="x86_64-pc-windows-msvc"
ARCHIVE_NAME="git-statuses-${{ steps.tagName.outputs.tag }}-$ARCHIVE_TARGET"
ARCHIVE_FILE="${ARCHIVE_NAME}.zip"
7z a ${ARCHIVE_FILE} ./target/release/git-statuses.exe
echo "::set-output name=file::${ARCHIVE_FILE}"
echo "::set-output name=name::${ARCHIVE_NAME}.zip"
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
ARCHIVE_FILE="git-statuses-${VERSION}-x86_64-pc-windows-msvc.zip"
7z a "$ARCHIVE_FILE" ./target/release/git-statuses.exe
echo "file=$ARCHIVE_FILE" >> "$GITHUB_OUTPUT"

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ steps.package.outputs.name }}
name: ${{ steps.package.outputs.file }}
path: ${{ steps.package.outputs.file }}

create-unix-binaries:
Expand All @@ -62,58 +46,39 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: actions/checkout@v7

- name: Install Rust
uses: actions-rs/toolchain@v1
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
targets: ${{ matrix.target }}

# macOS needs nothing extra: libgit2 uses the system TLS there, and OpenSSL is only
# vendored into the Linux build.
- name: Install musl-tools and musl OpenSSL
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools curl pkg-config libssl-dev
echo "Enable musl OpenSSL"
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
rustup target add x86_64-unknown-linux-musl

- name: Install OpenSSL on macOS
if: matrix.os == 'macos-latest'
run: |
brew install openssl
echo "OPENSSL_DIR=$(brew --prefix openssl@3)" >> $GITHUB_ENV
echo "PKG_CONFIG_ALLOW_CROSS=1" >> "$GITHUB_ENV"

- name: Build git-statuses
run: |
cargo build --release --target ${{ matrix.target }}
run: cargo build --release --locked --target ${{ matrix.target }}

- name: Strip binary
run: |
strip target/${{ matrix.target }}/release/git-statuses

- name: Get the version
id: tagName
run: |
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "::set-output name=tag::$VERSION"
run: strip target/${{ matrix.target }}/release/git-statuses

- name: Build package
id: package
run: |
TAR_FILE=git-statuses-${{ steps.tagName.outputs.tag }}-${{ matrix.target }}
cd target/${{ matrix.target }}/release
tar -czvf $GITHUB_WORKSPACE/$TAR_FILE.tar.gz git-statuses
echo ::set-output "name=name::${TAR_FILE}"
echo ::set-output "name=file::${TAR_FILE}.tar.gz "
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
TAR_FILE="git-statuses-${VERSION}-${{ matrix.target }}"
tar -czvf "$TAR_FILE.tar.gz" -C target/${{ matrix.target }}/release git-statuses
echo "name=$TAR_FILE" >> "$GITHUB_OUTPUT"
echo "file=$TAR_FILE.tar.gz" >> "$GITHUB_OUTPUT"

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ steps.package.outputs.name }}
path: ${{ steps.package.outputs.file }}
Expand All @@ -126,38 +91,53 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
lfs: true

- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Create Cargo.lock
run: |
cargo update

- name: Get version
id: tagName
run: |
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "::set-output name=tag::$VERSION"

- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
path: ./binaries
merge-multiple: true

- name: Create a release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
with:
name: v${{ steps.tagName.outputs.tag }}
name: v${{ github.ref_name }}
files: |
./binaries/**/*.zip
./binaries/**/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
./binaries/*.zip
./binaries/*.tar.gz

homebrew:
name: Update the Homebrew formula
needs: deploy
# Prereleases never become the formula's version.
if: ${{ !contains(github.ref_name, '-') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
sparse-checkout: scripts/homebrew_formula.sh
sparse-checkout-cone-mode: false

- name: Download the release archives
uses: actions/download-artifact@v8
with:
path: release
merge-multiple: true

- uses: actions/checkout@v7
with:
repository: bircni/homebrew-tap
ssh-key: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
path: tap

- name: Commit the formula
run: |
mkdir -p tap/Formula
bash scripts/homebrew_formula.sh "$GITHUB_REF_NAME" release > tap/Formula/git-statuses.rb
cd tap
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Formula/git-statuses.rb
if ! git diff --cached --quiet; then
git commit -m "git-statuses $GITHUB_REF_NAME"
git push
fi
5 changes: 4 additions & 1 deletion .github/workflows/publish_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
publish-check:
name: Publish Check
Expand All @@ -13,7 +16,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
lfs: true
- uses: Swatinem/rust-cache@v2
Expand Down
Loading
Loading