|
| 1 | +name: Release macOS |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + include: |
| 15 | + - target: x86_64-apple-darwin |
| 16 | + os: macos-13 |
| 17 | + - target: aarch64-apple-darwin |
| 18 | + os: macos-14 |
| 19 | + |
| 20 | + runs-on: ${{ matrix.os }} |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Install Rust toolchain |
| 26 | + uses: dtolnay/rust-toolchain@stable |
| 27 | + with: |
| 28 | + targets: ${{ matrix.target }} |
| 29 | + |
| 30 | + - name: Cache cargo registry and build |
| 31 | + uses: actions/cache@v4 |
| 32 | + with: |
| 33 | + path: | |
| 34 | + ~/.cargo/registry |
| 35 | + ~/.cargo/git |
| 36 | + target |
| 37 | + key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 38 | + restore-keys: ${{ matrix.target }}-cargo- |
| 39 | + |
| 40 | + - name: Build release binary |
| 41 | + run: cargo build --release --target ${{ matrix.target }} |
| 42 | + |
| 43 | + - name: Package binary |
| 44 | + run: | |
| 45 | + mkdir -p dist |
| 46 | + cp target/${{ matrix.target }}/release/wgit dist/wgit |
| 47 | + cd dist |
| 48 | + tar czf wgit-${{ matrix.target }}.tar.gz wgit |
| 49 | + shasum -a 256 wgit-${{ matrix.target }}.tar.gz > wgit-${{ matrix.target }}.tar.gz.sha256 |
| 50 | +
|
| 51 | + - name: Upload artifact |
| 52 | + uses: actions/upload-artifact@v4 |
| 53 | + with: |
| 54 | + name: wgit-${{ matrix.target }} |
| 55 | + path: dist/wgit-${{ matrix.target }}.tar.gz* |
| 56 | + |
| 57 | + release: |
| 58 | + needs: build |
| 59 | + runs-on: ubuntu-latest |
| 60 | + |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v4 |
| 63 | + |
| 64 | + - name: Download all artifacts |
| 65 | + uses: actions/download-artifact@v4 |
| 66 | + with: |
| 67 | + path: artifacts |
| 68 | + merge-multiple: true |
| 69 | + |
| 70 | + - name: Get short SHA |
| 71 | + id: sha |
| 72 | + run: echo "short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" |
| 73 | + |
| 74 | + - name: Create or update rolling release |
| 75 | + uses: softprops/action-gh-release@v2 |
| 76 | + with: |
| 77 | + tag_name: latest |
| 78 | + name: Latest Build (${{ steps.sha.outputs.short }}) |
| 79 | + body: | |
| 80 | + Rolling release from `master` at ${{ github.sha }}. |
| 81 | +
|
| 82 | + ### macOS Binaries |
| 83 | + - **Apple Silicon (M1/M2/M3):** `wgit-aarch64-apple-darwin.tar.gz` |
| 84 | + - **Intel:** `wgit-x86_64-apple-darwin.tar.gz` |
| 85 | + files: artifacts/* |
| 86 | + prerelease: true |
| 87 | + make_latest: false |
0 commit comments