Repository navigation
ci: build releases #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 Binaries | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| BIN_NAME: cowsync | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-15-intel | |
| target: x86_64-apple-darwin | |
| archive_name: cowsync-x86_64-apple-darwin.tar.gz | |
| - os: macos-14 | |
| target: aarch64-apple-darwin | |
| archive_name: cowsync-aarch64-apple-darwin.tar.gz | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| archive_name: cowsync-x86_64-unknown-linux-gnu.tar.gz | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| archive_name: cowsync-aarch64-unknown-linux-gnu.tar.gz | |
| steps: | |
| - name: Check out source | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install Linux ARM64 linker | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Build release binary | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
| run: cargo build --locked --release --target ${{ matrix.target }} | |
| - name: Package archive | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| cp target/${{ matrix.target }}/release/${BIN_NAME} dist/${BIN_NAME} | |
| tar -C dist -czf dist/${{ matrix.archive_name }} ${BIN_NAME} | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.target }} | |
| path: dist/${{ matrix.archive_name }} | |
| if-no-files-found: error | |
| release: | |
| name: Attach Release Assets | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download built artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Publish GitHub release assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/*.tar.gz |