Skip to content

Commit 57e4d13

Browse files
authored
chore: use trusted cargo publishing (#227)
1 parent b1087b3 commit 57e4d13

File tree

3 files changed

+43
-23
lines changed

3 files changed

+43
-23
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: ci
22
on: [push, pull_request]
33

44
jobs:
5-
build:
5+
build-rust:
66
runs-on: ubuntu-latest
77
env:
88
RUST_BACKTRACE: full
@@ -11,40 +11,41 @@ jobs:
1111

1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v4
15-
14+
uses: actions/checkout@v5
1615
- name: Install rust
1716
uses: dsherret/rust-toolchain-file@v1
17+
- name: Clippy
18+
run: |
19+
cargo clippy --all-targets --locked --no-default-features
20+
cargo clippy --all-targets --locked
21+
cargo clippy --all-targets --locked --all-features
22+
- name: Test
23+
run: cargo test --all-features --locked
1824

25+
build-javascript:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v5
30+
- name: Install rust
31+
uses: dsherret/rust-toolchain-file@v1
1932
- name: Install Deno
2033
uses: denoland/setup-deno@v1
2134
with:
22-
deno-version: 1.x
23-
24-
- uses: actions/setup-node@v2
35+
deno-version: 2.x
36+
- uses: actions/setup-node@v5
2537
with:
26-
node-version: '18.x'
38+
node-version: '20.x'
2739
registry-url: 'https://registry.npmjs.org'
2840

29-
- name: Clippy
30-
run: |
31-
cargo clippy --all-targets --locked --no-default-features
32-
cargo clippy --all-targets --locked
33-
cargo clippy --all-targets --locked --all-features
34-
3541
- name: Build
3642
run: deno task build && deno task node
37-
3843
- name: Test
39-
run: |
40-
cargo test --all-features --locked
41-
deno task test
42-
44+
run: deno task test
4345
- name: Get tag version
4446
if: startsWith(github.ref, 'refs/tags/')
4547
id: get_tag_version
4648
run: echo TAG_VERSION=${GITHUB_REF/refs\/tags\//} >> "$GITHUB_OUTPUT"
47-
4849
- name: Publish deno.land/x
4950
uses: denoland/publish-folder@82ce065074e7174baf444332c4b7c40869a4909a
5051
if: startsWith(github.ref, 'refs/tags/')
@@ -55,10 +56,8 @@ jobs:
5556
token: ${{ secrets.DENOBOT_PAT }}
5657
git-user-name: denobot
5758
git-user-email: denobot@users.noreply.github.com
58-
5959
- name: Build npm
6060
run: deno run -A ./build_npm.ts ${{ github.ref_name }}
61-
6261
- name: Publish npm
6362
if: |
6463
github.repository == 'denoland/eszip' &&

.github/workflows/publish.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
steps:
15+
- name: Clone repository
16+
uses: actions/checkout@v5
17+
- uses: rust-lang/crates-io-auth-action@v1
18+
id: auth
19+
- run: cargo publish
20+
env:
21+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- name: Clone repository
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v5
2424
with:
2525
token: ${{ secrets.DENOBOT_PAT }}
2626

@@ -34,4 +34,4 @@ jobs:
3434
run: |
3535
git config user.email "denobot@users.noreply.github.com"
3636
git config user.name "denobot"
37-
deno run -A https://raw.githubusercontent.com/denoland/automation/0.14.1/tasks/publish_release.ts --${{github.event.inputs.releaseKind}} eszip
37+
deno run -A jsr:@deno/rust-automation@0.21.0/publish-release --${{github.event.inputs.releaseKind}} eszip

0 commit comments

Comments
 (0)