chore: simplify contributor listing to avoid unique filter #12
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| name: Release ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| artifact_name: sshdb-linux-x86_64 | |
| asset_name: sshdb-linux-x86_64.tar.gz | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact_name: sshdb-macos-x86_64 | |
| asset_name: sshdb-macos-x86_64.tar.gz | |
| - os: macos-14 | |
| target: aarch64-apple-darwin | |
| artifact_name: sshdb-macos-aarch64 | |
| asset_name: sshdb-macos-aarch64.tar.gz | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact_name: sshdb-windows-x86_64 | |
| asset_name: sshdb-windows-x86_64.zip | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - name: Add target | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}- | |
| - name: Build release binary | |
| run: cargo build --release --target ${{ matrix.target }} --verbose | |
| - name: Prepare release asset (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| Compress-Archive -Path sshdb.exe -DestinationPath ${{ github.workspace }}/${{ matrix.asset_name }} -Force | |
| - name: Prepare release asset (Unix) | |
| if: matrix.os != 'windows-latest' | |
| shell: bash | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar czf ${{ github.workspace }}/${{ matrix.asset_name }} sshdb | |
| - name: Upload release asset | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: ${{ matrix.asset_name }} | |
| retention-days: 30 | |
| create-release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| name: Create Release | |
| needs: release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Extract version from tag | |
| id: tag | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Install Rust toolchain (for git-cliff) | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - name: Install git-cliff | |
| run: | | |
| cargo install --locked git-cliff | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Generate changelog from git history | |
| run: git-cliff --config .gitcliff.toml --latest --output release-notes.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate checksums | |
| run: | | |
| find artifacts -type f \( -name "sshdb-*.tar.gz" -o -name "sshdb-*.zip" \) -print0 \ | |
| | sort -z \ | |
| | xargs -0 sha256sum > checksums.txt | |
| - name: Generate Homebrew formula and push tap | |
| if: "${{ env.HOMEBREW_TAP_TOKEN != '' }}" | |
| env: | |
| VERSION: ${{ steps.tag.outputs.VERSION }} | |
| HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| TAR_URL="https://github.com/ruphy/sshdb/archive/refs/tags/v${VERSION}.tar.gz" | |
| SHA256=$(curl -L "$TAR_URL" | shasum -a 256 | awk '{print $1}') | |
| TAP_DIR=$(mktemp -d) | |
| git config --global user.name "sshdb-release-bot" | |
| git config --global user.email "[email protected]" | |
| git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/ruphy/homebrew-sshdb" "${TAP_DIR}" | |
| mkdir -p "${TAP_DIR}/Formula" | |
| cat > "${TAP_DIR}/Formula/sshdb.rb" <<EOF | |
| class Sshdb < Formula | |
| desc "Keyboard-first SSH library and launcher TUI" | |
| homepage "https://github.com/ruphy/sshdb" | |
| url "${TAR_URL}" | |
| sha256 "${SHA256}" | |
| license "GPL-3.0-or-later" | |
| depends_on "rust" => :build | |
| def install | |
| system "cargo", "install", *std_cargo_args | |
| end | |
| test do | |
| system "#{bin}/sshdb", "--help" | |
| end | |
| end | |
| EOF | |
| cd "${TAP_DIR}" | |
| git add Formula/sshdb.rb | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit for tap." | |
| else | |
| git commit -m "sshdb ${VERSION}" | |
| git push origin HEAD:main | |
| fi | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.ref }} | |
| name: Release ${{ steps.tag.outputs.VERSION }} | |
| body_path: release-notes.md | |
| files: | | |
| artifacts/*/sshdb-*.tar.gz | |
| artifacts/*/sshdb-*.zip | |
| checksums.txt | |
| draft: false | |
| prerelease: false |