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

Commit 0fbbf85

Browse files
committed
Add a job for publishing releases to crates.io
1 parent 2389717 commit 0fbbf85

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

.github/workflows/release.yml

+26-11
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
strategy:
1313
matrix:
1414
include:
15-
- os: windows-2022
16-
target: x86_64-pc-windows-msvc
17-
- os: ubuntu-22.04
18-
target: x86_64-unknown-linux-gnu
19-
- os: macos-12
20-
target: x86_64-apple-darwin
21-
- os: macos-12
22-
target: aarch64-apple-darwin
15+
- os: windows-2022
16+
target: x86_64-pc-windows-msvc
17+
- os: ubuntu-22.04
18+
target: x86_64-unknown-linux-gnu
19+
- os: macos-12
20+
target: x86_64-apple-darwin
21+
- os: macos-12
22+
target: aarch64-apple-darwin
2323

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

@@ -46,10 +46,8 @@ jobs:
4646
shopt -s extglob
4747
staging="keep-active-${{ github.head_ref || github.ref_name }}-${{ matrix.target }}"
4848
mkdir $staging
49-
5049
cp target/${{ matrix.target }}/release/keep-active@(|.exe) $staging/
5150
cp README.md CHANGELOG.md LICENSE $staging/
52-
5351
tar zcf $staging.tar.gz $staging
5452
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
5553
@@ -63,4 +61,21 @@ jobs:
6361
if: startsWith(github.ref, 'refs/tags/')
6462
with:
6563
draft: true
66-
files: ${{ env.ASSET }}
64+
files: ${{ env.ASSET }}
65+
66+
publish-crate:
67+
needs: [release] # This job depends on the successful completion of the 'release' job
68+
runs-on: ubuntu-latest
69+
if: startsWith(github.ref, 'refs/tags/') # Only runs this job if the push is a tag
70+
steps:
71+
- uses: actions/checkout@v3
72+
73+
- name: Setup Rust
74+
uses: actions-rust-lang/setup-rust-toolchain@v1
75+
with:
76+
profile: minimal # Only install what's necessary
77+
78+
- name: Publish to crates.io
79+
env:
80+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} # Use the secret token
81+
run: cargo publish --token $CARGO_REGISTRY_TOKEN

0 commit comments

Comments
 (0)