Skip to content

Commit 8f42669

Browse files
ci: add publish workflow (#327)
1 parent 68b76a4 commit 8f42669

2 files changed

Lines changed: 49 additions & 7 deletions

File tree

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
name: Publish
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v6
19+
20+
- name: Set up Rust toolchain
21+
uses: actions-rust-lang/setup-rust-toolchain@v1
22+
with:
23+
target: wasm32-unknown-unknown
24+
25+
- name: Install Cargo Binary Install
26+
uses: cargo-bins/cargo-binstall@main
27+
28+
- name: Install crates
29+
run: cargo binstall --force -y cargo-workspaces
30+
31+
- uses: rust-lang/crates-io-auth-action@v1
32+
id: auth
33+
34+
- name: Publish
35+
run: cargo workspaces publish --publish-as-is
36+
env:
37+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

.github/workflows/release.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
run: git add .
5454

5555
- name: Commit
56+
id: commit
5657
uses: dsanders11/github-app-commit-action@v1
5758
with:
5859
message: ${{ steps.extract-version.outputs.VERSION }}
@@ -62,11 +63,18 @@ jobs:
6263
run: git reset --hard && git pull
6364

6465
- name: Tag
65-
uses: bruno-fs/repo-tagger@1.0.0
66-
with:
67-
tag: ${{ steps.extract-version.outputs.VERSION }}
66+
uses: actions/github-script@v8
6867
env:
69-
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
68+
GIT_TAG: ${{ steps.extract-version.outputs.VERSION }}
69+
GIT_SHA: ${{ steps.commit.outputs.sha }}
70+
with:
71+
script: |
72+
github.rest.git.createRef({
73+
owner: context.repo.owner,
74+
repo: context.repo.repo,
75+
ref: `refs/tags/${process.env.GIT_TAG}`,
76+
sha: process.env.GIT_SHA
77+
})
7078
7179
- name: Release
7280
uses: softprops/action-gh-release@v2
@@ -75,6 +83,3 @@ jobs:
7583
make_latest: true
7684
tag_name: ${{ steps.extract-version.outputs.VERSION }}
7785
token: ${{ steps.app-token.outputs.token }}
78-
79-
- name: Publish
80-
run: cargo workspaces publish --publish-as-is --token "${{ secrets.CRATES_IO_TOKEN }}"

0 commit comments

Comments
 (0)