|
9 | 9 |
|
10 | 10 | jobs: |
11 | 11 | build: |
12 | | - runs-on: windows-latest |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + include: |
| 15 | + - os: ubuntu-latest |
| 16 | + target: x86_64-unknown-linux-gnu |
| 17 | + exec_name: rw3d_cli |
| 18 | + - os: windows-latest |
| 19 | + target: x86_64-pc-windows-msvc |
| 20 | + exec_name: rw3d_cli.exe |
13 | 21 |
|
| 22 | + runs-on: ${{ matrix.os }} |
14 | 23 | steps: |
15 | 24 | - name: Checkout |
16 | 25 | uses: actions/checkout@v2 |
17 | 26 | - name: Use Rust stable |
18 | 27 | uses: actions-rs/toolchain@v1 |
19 | 28 | with: |
20 | 29 | toolchain: stable |
21 | | - target: x86_64-pc-windows-msvc |
| 30 | + target: ${{ matrix.target }} |
22 | 31 | override: true |
23 | 32 | - name: Build with Cargo |
24 | 33 | uses: actions-rs/cargo@v1 |
25 | 34 | with: |
26 | 35 | command: build |
27 | | - args: --package rw3d_cli --release --target=x86_64-pc-windows-msvc |
| 36 | + args: --package rw3d_cli --release --target ${{ matrix.target }} |
| 37 | + |
28 | 38 | - name: Zip the executable |
29 | 39 | uses: papeloto/action-zip@v1 |
30 | 40 | with: |
31 | | - files: "target/x86_64-pc-windows-msvc/release/rw3d_cli.exe" |
32 | | - dest: "rw3d_cli_${{ github.ref_name }}.zip" |
33 | | - - name: Create draft release |
| 41 | + files: "target/${{ matrix.target }}/release/${{ matrix.exec_name }}" |
| 42 | + dest: "rw3d_cli-${{ github.ref_name }}-${{ matrix.target }}.zip" |
| 43 | + - name: Upload artifacts |
| 44 | + uses: actions/upload-artifact@v2 |
| 45 | + with: |
| 46 | + name: ${{ matrix.target }} |
| 47 | + path: "*.zip" |
| 48 | + if-no-files-found: error |
| 49 | + |
| 50 | + publish: |
| 51 | + runs-on: ubuntu-latest |
| 52 | + needs: build |
| 53 | + if: success() |
| 54 | + |
| 55 | + steps: |
| 56 | + - name: Download artifacts |
| 57 | + uses: actions/download-artifact@v2 |
| 58 | + |
| 59 | + - name: Prepare artifact list for release action |
| 60 | + run: echo "ARTIFACTS=$(echo $(find . -iname "*.zip") | sed "s/ /,/g")" >> $GITHUB_ENV |
| 61 | + - name: Create draft release on GitHub |
34 | 62 | uses: ncipollo/release-action@v1 |
35 | 63 | with: |
36 | | - artifacts: "rw3d_cli_${{ github.ref_name }}.zip" |
| 64 | + artifacts: "${{ env.ARTIFACTS }}" |
37 | 65 | draft: true |
| 66 | + allowUpdates: true |
38 | 67 | generateReleaseNotes: true |
0 commit comments