Release #3
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: | |
| inputs: | |
| tag: | |
| description: "Release tag to build (e.g. v0.2.0)" | |
| required: true | |
| default: "v0.2.0" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| archive: tar.gz | |
| - os: macos-latest # ARM runner, cross-compiles to x86_64 via LLVM | |
| target: x86_64-apple-darwin | |
| archive: tar.gz | |
| - os: macos-latest # ARM runner, native aarch64 | |
| target: aarch64-apple-darwin | |
| archive: tar.gz | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| archive: zip | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| # NOTE: No system SQLCipher/OpenSSL packages needed. | |
| # Cargo.toml uses bundled-sqlcipher-vendored-openssl which compiles | |
| # SQLCipher and OpenSSL entirely from source on every platform. | |
| - name: Add NASM to PATH (Windows — required by vendored-openssl) | |
| if: runner.os == 'Windows' | |
| run: echo "C:\Program Files\NASM" >> $env:GITHUB_PATH | |
| - name: Build release | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar czf ../../../dotkeep-${{ matrix.target }}.tar.gz dotkeep | |
| cd ../../.. | |
| - name: Package (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| Compress-Archive dotkeep.exe ../../../dotkeep-${{ matrix.target }}.zip | |
| cd ../../.. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dotkeep-${{ matrix.target }} | |
| path: dotkeep-${{ matrix.target }}.* | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }} | |
| files: artifacts/**/* | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |