Skip to content

Commit 1a2b2f7

Browse files
authored
chore: update workflows (#2915)
* chore: update workflows * chore: update workflows * chore: update workflows * chore: update workflows * chore: update workflows * chore: update workflows * chore: update workflows * chore: update workflows * chore: update workflows * chore: update workflows
1 parent 219bc7a commit 1a2b2f7

File tree

3 files changed

+46
-42
lines changed

3 files changed

+46
-42
lines changed

.github/workflows/check.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,9 @@ on:
44
branches: [master, dev]
55
pull_request:
66
branches: [dev]
7+
78
jobs:
89
check:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- name: Checkout
12-
uses: actions/checkout@v3
13-
- name: Setup Node.js
14-
uses: actions/setup-node@v3
15-
with:
16-
node-version: 'lts/*'
17-
cache: 'npm'
18-
- name: Install dependencies
19-
run: npm install -g codecov && npm install
20-
- name: Run Lint
21-
run: npm run lint
22-
- name: Run tests
23-
run: npm test
24-
- name: Upload coverage
25-
run: codecov || echo "Codecov upload failed, continuing..."
10+
uses: ./.github/workflows/lint-test.yml
11+
secrets:
12+
inherit

.github/workflows/lint-test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
on:
2+
workflow_call:
3+
secrets:
4+
CODECOV_TOKEN:
5+
required: true
6+
7+
jobs:
8+
lint-and-test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
- name: Setup Node
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: 'lts/*'
17+
cache: 'npm'
18+
- name: Install dependencies
19+
run: npm install
20+
- name: Run Lint
21+
run: npm run lint
22+
- name: Run tests
23+
run: npm test
24+
- name: Upload coverage to Codecov
25+
uses: codecov/codecov-action@v4
26+
with:
27+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release.yml

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,42 @@
11
name: Release
22
on:
3-
workflow_run:
4-
workflows: ['Lint & Unit Test']
3+
push:
54
branches: [master]
6-
types:
7-
- completed
8-
9-
permissions:
10-
contents: read # for checkout
115

126
jobs:
7+
lint-and-test:
8+
uses: ./.github/workflows/lint-test.yml
9+
secrets:
10+
inherit
1311
release:
14-
env:
15-
GITHUB_TRIGGER_REF: ${{ github.event.workflow_run.head_branch }} # For workflow_run the GITHUB_REF is the default branch, as mentioned in the docs
16-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
17-
name: Release
12+
needs: lint-and-test
1813
runs-on: ubuntu-latest
1914
permissions:
20-
contents: write # to be able to publish a GitHub release
21-
issues: write # to be able to comment on released issues
22-
pull-requests: write # to be able to comment on released pull requests
23-
id-token: write # to enable use of OIDC for npm provenance
15+
contents: write
16+
issues: write
17+
pull-requests: write
18+
id-token: write
2419
steps:
2520
- name: Checkout
2621
uses: actions/checkout@v3
2722
with:
2823
fetch-depth: 0
29-
ref: ${{ env.GITHUB_TRIGGER_REF }}
3024
- name: Setup Node.js
3125
uses: actions/setup-node@v3
3226
with:
33-
node-version: 'lts/*' # semantic-release requires Node >= 18
27+
node-version: 'lts/*'
3428
- name: Install dependencies
3529
run: npm clean-install
3630
- name: Build
37-
env: # temporary workaround for "Error: error:0308010C:digital envelope routines::unsupported" in Node lts / 18
31+
env:
3832
NODE_OPTIONS: --openssl-legacy-provider
3933
run: npm run build && npm run babel
40-
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
34+
- name: Verify provenance
4135
run: npm audit signatures
4236
- name: Release
4337
env:
4438
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4539
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4640
run: |
47-
npm install -g @semantic-release/changelog @semantic-release/git semantic-release
48-
GITHUB_REF=${{ env.GITHUB_TRIGGER_REF }} semantic-release
49-
echo release success
50-
- name: Notify
51-
run: |
52-
curl -s ${{ secrets.GITEE_SYNC_URL }}
41+
npm install -g @semantic-release/changelog @semantic-release/git semantic-release
42+
semantic-release

0 commit comments

Comments
 (0)