chore: release version 1.0.0 #2
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*"] | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| name: release-${{ matrix.platform.asset_name }} | |
| runs-on: ${{ matrix.platform.os }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| asset_name: linux | |
| arch: x86_64 | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| asset_name: darwin | |
| arch: x86_64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| asset_name: darwin | |
| arch: aarch64 | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| asset_name: windows | |
| arch: x86_64 | |
| env: | |
| BINARY_NAME: keywatch-${{ matrix.platform.asset_name }}-${{ matrix.platform.arch }}${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract Release Notes | |
| id: release-notes | |
| if: matrix.platform.os == 'ubuntu-latest' | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| NOTES=$(awk -v ver="$VERSION" ' | |
| /^## \[/ { if (p) { exit }; if ($2 == "['ver']") { p=1; next } } | |
| p { print } | |
| ' CHANGELOG.md) | |
| echo "NOTES<<EOF" >> $GITHUB_OUTPUT | |
| echo "$NOTES" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.platform.target }} | |
| # Add cross-compilation support | |
| - name: Install cross-compilation tools | |
| if: matrix.platform.target == 'aarch64-apple-darwin' | |
| run: | | |
| brew install FiloSottile/musl-cross/musl-cross | |
| rustup target add aarch64-apple-darwin | |
| # Build the specific package | |
| - name: Build Binary | |
| run: | | |
| cargo build --release --target ${{ matrix.platform.target }} | |
| env: | |
| CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER: aarch64-apple-darwin-gcc | |
| - name: Prepare Asset | |
| shell: bash | |
| run: | | |
| mkdir -p release | |
| cp target/${{ matrix.platform.target }}/release/key-watch${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }} \ | |
| release/${{ env.BINARY_NAME }} | |
| # Create checksum | |
| - name: Generate SHA-256 | |
| run: | | |
| cd release | |
| if [ "${{ matrix.platform.os }}" = "windows-latest" ]; then | |
| certutil -hashfile ${{ env.BINARY_NAME }} SHA256 | grep -v "hash" > ${{ env.BINARY_NAME }}.sha256 | |
| else | |
| shasum -a 256 ${{ env.BINARY_NAME }} > ${{ env.BINARY_NAME }}.sha256 | |
| fi | |
| # Create Release | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: "KeyWatch ${{ github.ref_name }}" | |
| files: | | |
| release/${{ env.BINARY_NAME }} | |
| release/${{ env.BINARY_NAME }}.sha256 | |
| body: ${{ steps.release-notes.outputs.NOTES }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |