|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +env: |
| 9 | + CARGO_TERM_COLOR: always |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build ${{ matrix.target }} |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - os: ubuntu-latest |
| 19 | + target: x86_64-unknown-linux-gnu |
| 20 | + artifact_name: rustfox |
| 21 | + asset_name: rustfox-linux-x86_64 |
| 22 | + - os: macos-latest |
| 23 | + target: x86_64-apple-darwin |
| 24 | + artifact_name: rustfox |
| 25 | + asset_name: rustfox-macos-x86_64 |
| 26 | + - os: macos-latest |
| 27 | + target: aarch64-apple-darwin |
| 28 | + artifact_name: rustfox |
| 29 | + asset_name: rustfox-macos-aarch64 |
| 30 | + - os: windows-latest |
| 31 | + target: x86_64-pc-windows-msvc |
| 32 | + artifact_name: rustfox.exe |
| 33 | + asset_name: rustfox-windows-x86_64.exe |
| 34 | + |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - uses: dtolnay/rust-toolchain@stable |
| 39 | + with: |
| 40 | + targets: ${{ matrix.target }} |
| 41 | + |
| 42 | + - uses: Swatinem/rust-cache@v2 |
| 43 | + with: |
| 44 | + key: ${{ matrix.target }} |
| 45 | + |
| 46 | + - name: Build |
| 47 | + run: cargo build --release --target ${{ matrix.target }} |
| 48 | + |
| 49 | + - name: Upload artifact |
| 50 | + uses: actions/upload-artifact@v4 |
| 51 | + with: |
| 52 | + name: ${{ matrix.asset_name }} |
| 53 | + path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }} |
| 54 | + if-no-files-found: error |
| 55 | + |
| 56 | + release: |
| 57 | + name: Create Release |
| 58 | + needs: build |
| 59 | + runs-on: ubuntu-latest |
| 60 | + permissions: |
| 61 | + contents: write |
| 62 | + |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + |
| 66 | + - name: Download all artifacts |
| 67 | + uses: actions/download-artifact@v4 |
| 68 | + with: |
| 69 | + path: artifacts |
| 70 | + |
| 71 | + - name: Create release |
| 72 | + uses: softprops/action-gh-release@v2 |
| 73 | + with: |
| 74 | + files: artifacts/**/* |
| 75 | + generate_release_notes: true |
0 commit comments