From 0dd4cffc3b1e787183079d43fdd69b60b35329ea Mon Sep 17 00:00:00 2001 From: Spenser Black Date: Mon, 13 Nov 2023 12:05:15 -0500 Subject: [PATCH] Specify target for release artifacts (#250) Instead of just building whatever target the GitHub Action runners default to, this builds release assets for specific targets. This will also make it easier for future contributions to add targets. --- .github/workflows/release.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cf77ed7..0c0106ea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,24 +26,29 @@ jobs: run: cargo publish -p gengo-bin github: - name: GitHub Assets + name: Build ${{ matrix.target }} runs-on: ${{ matrix.os }} permissions: contents: write strategy: fail-fast: false matrix: - os: - - macos-latest - - ubuntu-latest - - windows-latest + include: + - os: macos-latest + target: x86_64-apple-darwin + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: windows-latest + target: x86_64-pc-windows-msvc steps: - uses: actions/checkout@v4 + - name: Add target + run: rustup target add ${{ matrix.target }} - name: Build Assets run: | - cargo build --release - tar -C target/release/ -czvf gengo-${{ runner.os }}-${{ runner.arch }}.tar.gz gengo${{ runner.os == 'Windows' && '.exe' || '' }} + cargo build --release --target ${{ matrix.target }} + tar -C target/${{ matrix.target }}/release/ -czvf gengo-${{ matrix.target }}.tar.gz gengo${{ runner.os == 'Windows' && '.exe' || '' }} - name: Upload Release Assets if: ${{ github.event_name != 'workflow_dispatch' }} uses: softprops/action-gh-release@v1