-
-
Notifications
You must be signed in to change notification settings - Fork 8
42 lines (34 loc) · 1.08 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Publish
on:
workflow_call:
workflow_dispatch:
jobs:
check-secret-existence:
runs-on: ubuntu-latest
steps:
- name: Get secret
id: secret
run: |
token=${{ secrets.CARGO_REGISTRY_TOKEN != '' }};
echo "token_exists=$token" >> "$GITHUB_OUTPUT";
- name: print if skip publish-crate
if: ${{ steps.secret.outputs.token_exists == 'false' }}
run: |
echo "add secrets.CARGO_REGISTRY_TOKEN to your github repo";
outputs:
secret_exists: ${{ steps.secret.outputs.token_exists }}
publish-crate:
needs: [check-secret-existence]
if: ${{ needs.check-secret-existence.outputs.secret_exists == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
uses: actions/checkout@v4
- run: git pull
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Cargo Publish
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
ignore-unpublished-changes: true