Skip to content

Commit

Permalink
fix: release for multiple architectures (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianGoeb authored Apr 24, 2023
1 parent c1a75de commit cb0a0ab
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 7 deletions.
52 changes: 47 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,63 @@ on:
branches: [main] # semantic-release supports distribution channels via other branches
concurrency: cd # don't run multiple releases in parallel and mess up the versions
jobs:
release:
runs-on: ubuntu-latest
build:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
os:
- linux
- macos

include:
- os: linux
runs_on: ubuntu-latest
target: x86_64-unknown-linux-gnu

- os: macos
runs_on: macos-latest
target: x86_64-apple-darwin
runs-on: ${{ matrix.runs_on }}
steps:
# setup
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Rust
uses: ./.github/actions/setup

- name: Install target
shell: bash
run: rustup target add ${{ matrix.target }}

# build
- name: Build
shell: bash
run: cargo build --release
run: cargo build --release --target ${{ matrix.target }}

- name: Rename binary
shell: bash
run: mv target/${{ matrix.target }}/release/kindle-to-anki target/${{ matrix.target }}/release/kindle-to-anki-${{ matrix.os }}

- name: Save binary for later
uses: actions/upload-artifact@v3
with:
name: release-${{ matrix.os }}
path: target/${{ matrix.target }}/release/kindle-to-anki-${{ matrix.os }}

release:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Fetch binaries for all platforms
uses: actions/download-artifact@v3
with:
path: release

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main]
jobs:
build:
test:
runs-on: ubuntu-latest
steps:
# setup
Expand Down
2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@semantic-release/github",
{
"assets": [
"target/release/kindle-to-anki"
"release/**"
]
}
]
Expand Down

0 comments on commit cb0a0ab

Please sign in to comment.