Skip to content

Commit 836542b

Browse files
committed
chore: use trusted cargo publishing
1 parent d9700df commit 836542b

File tree

3 files changed

+60
-46
lines changed

3 files changed

+60
-46
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: ci
22

33
on: [push, pull_request]
44

5-
permissions:
6-
contents: write
7-
85
jobs:
96
rust:
107
name: deno_lint-${{ matrix.os }}
@@ -26,52 +23,22 @@ jobs:
2623

2724
steps:
2825
- name: Clone repository
29-
uses: actions/checkout@v3
26+
uses: actions/checkout@v5
3027
with:
3128
submodules: true
3229
persist-credentials: false
3330

3431
- uses: dsherret/rust-toolchain-file@v1
3532

36-
- name: Install Deno
37-
uses: denoland/setup-deno@v1
38-
with:
39-
deno-version: v2.x
40-
41-
- name: Install Node.js
42-
if: contains(matrix.os, 'ubuntu')
43-
uses: actions/setup-node@v3
44-
with:
45-
node-version: "18"
46-
47-
- name: Install npm packages
48-
if: contains(matrix.os, 'ubuntu')
49-
run: npm install --ci
50-
working-directory: benchmarks
51-
5233
- uses: Swatinem/rust-cache@v2
5334
with:
5435
save-if: ${{ github.ref == 'refs/heads/main' }}
5536

56-
- name: Format
57-
if: contains(matrix.os, 'ubuntu')
58-
run: deno run --allow-run ./tools/format.ts --check
59-
6037
- name: Build
6138
run: cargo build --locked --release --all-targets --all-features
6239

6340
- name: Test
64-
run: |
65-
cargo test --locked --release --all-targets --all-features
66-
deno test --unstable --allow-read=. --allow-write=. --allow-run --allow-env ./tools
67-
68-
- name: Lint
69-
if: contains(matrix.os, 'ubuntu')
70-
run: deno run --allow-run --allow-env ./tools/lint.ts --release
71-
72-
- name: Benchmarks
73-
if: contains(matrix.os, 'ubuntu')
74-
run: deno run -A --quiet benchmarks/benchmarks.ts
41+
run: cargo test --locked --release --all-targets --all-features
7542

7643
- name: Pre-release (linux)
7744
if: |
@@ -107,12 +74,38 @@ jobs:
10774
target/release/examples/dlint-x86_64-apple-darwin.zip
10875
draft: true
10976

110-
- name: Publish
111-
if: |
112-
contains(matrix.os, 'ubuntu') &&
113-
github.repository == 'denoland/deno_lint' &&
114-
startsWith(github.ref, 'refs/tags/')
115-
env:
116-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
117-
run: |
118-
cargo publish -vv
77+
javascript:
78+
runs-on: ubuntu-latest
79+
steps:
80+
- name: Clone repository
81+
uses: actions/checkout@v5
82+
with:
83+
submodules: true
84+
persist-credentials: false
85+
- uses: dsherret/rust-toolchain-file@v1
86+
- name: Install Deno
87+
uses: denoland/setup-deno@v1
88+
with:
89+
deno-version: v2.x
90+
- name: Install Node.js
91+
uses: actions/setup-node@v5
92+
with:
93+
node-version: "20"
94+
- name: Install npm packages
95+
run: npm install --ci
96+
working-directory: benchmarks
97+
- uses: Swatinem/rust-cache@v2
98+
with:
99+
save-if: ${{ github.ref == 'refs/heads/main' }}
100+
101+
- name: Format
102+
run: deno run --allow-run ./tools/format.ts --check
103+
104+
- name: Test
105+
run: deno test --unstable --allow-read=. --allow-write=. --allow-run --allow-env ./tools
106+
107+
- name: Lint
108+
run: deno run --allow-run --allow-env ./tools/lint.ts --release
109+
110+
- name: Benchmarks
111+
run: deno run -A --quiet benchmarks/benchmarks.ts

.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@v3
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 "[email protected]"
3636
git config user.name "denobot"
37-
deno run -A https://raw.githubusercontent.com/denoland/automation/0.16.1/tasks/publish_release.ts --${{github.event.inputs.releaseKind}}
37+
deno run -A jsr:@deno/rust-automation@0.22.0/publish-release --${{github.event.inputs.releaseKind}}

0 commit comments

Comments
 (0)