Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(github): add release workflow #4

Merged
merged 6 commits into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

env:
CARGO_TERM_COLOR: always

Expand All @@ -15,6 +13,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
major: ${{ steps.release.outputs.major }}
minor: ${{ steps.release.outputs.minor }}
patch: ${{ steps.release.outputs.patch }}
Expand All @@ -25,22 +24,33 @@ jobs:
release-type: rust

upload:
runs-on: ubuntu-latest
name: Build and upload ${{ matrix.platform.target }}
runs-on: ${{ matrix.platform.os }}
needs: release-please
if: ${{ needs.release-please.outputs.releases_created == 'false' }}
env:
TAG_NAME: ${{ needs.release-please.outputs.major }}.${{ needs.release-please.outputs.minor }}.${{ needs.release-please.outputs.patch }}
strategy:
matrix:
platform:
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-latest-large
target: x86_64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Rustup target
run: rustup target add ${{ matrix.platform.target }}

- name: Cargo build
run: |
cargo build --release --target aarch64-apple-darwin
cargo build --release --target x86_64-apple-darwin
run: cargo build --release --target ${{ matrix.platform.target }}

# - name: Upload release artifacts
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh release upload ${{ env.TAG_NAME }} ./target/some-build-artifact.zip
- name: Create tar and upload artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd target/${{ matrix.platform.target }}/release
tar -czf tsc-cli-${{ env.TAG_NAME }}-${{ matrix.platform.target }}.tar.gz tsc-cli
gh release upload --clobber ${{ needs.release-please.outputs.tag_name }} tsc-cli-${{ env.TAG_NAME }}-${{ matrix.platform.target }}.tar.gz
Loading