Skip to content

Commit

Permalink
Specify target for release artifacts (#250)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
spenserblack authored Nov 13, 2023
1 parent 9d1b77a commit 0dd4cff
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0dd4cff

Please sign in to comment.