Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Add a job for publishing releases to crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
omerbustun committed Feb 2, 2024
1 parent 2389717 commit 0fbbf85
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
strategy:
matrix:
include:
- os: windows-2022
target: x86_64-pc-windows-msvc
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- os: macos-12
target: x86_64-apple-darwin
- os: macos-12
target: aarch64-apple-darwin
- os: windows-2022
target: x86_64-pc-windows-msvc
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- os: macos-12
target: x86_64-apple-darwin
- os: macos-12
target: aarch64-apple-darwin

runs-on: ${{ matrix.os }}

Expand All @@ -46,10 +46,8 @@ jobs:
shopt -s extglob
staging="keep-active-${{ github.head_ref || github.ref_name }}-${{ matrix.target }}"
mkdir $staging
cp target/${{ matrix.target }}/release/keep-active@(|.exe) $staging/
cp README.md CHANGELOG.md LICENSE $staging/
tar zcf $staging.tar.gz $staging
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
Expand All @@ -63,4 +61,21 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: ${{ env.ASSET }}
files: ${{ env.ASSET }}

publish-crate:
needs: [release] # This job depends on the successful completion of the 'release' job
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') # Only runs this job if the push is a tag
steps:
- uses: actions/checkout@v3

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal # Only install what's necessary

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} # Use the secret token
run: cargo publish --token $CARGO_REGISTRY_TOKEN

0 comments on commit 0fbbf85

Please sign in to comment.