-
-
Notifications
You must be signed in to change notification settings - Fork 2
126 lines (95 loc) · 3.42 KB
/
Copy pathpublish.yml
File metadata and controls
126 lines (95 loc) · 3.42 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: publish
on:
release:
types: [published]
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-24.04
timeout-minutes: 15
env:
PUPPETEER_VERSION: 25.2.1
steps:
- name: Validate semver tag
run: |
TAG="${GITHUB_REF_NAME}"
if [[ ! "${TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Tag '${TAG}' is not valid semver (expected X.Y.Z)"
exit 1
fi
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Use Node.js LTS
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: lts/*
- name: Get npm cache location
id: get-npm-cache
shell: bash
run: |
echo "NPM_CONFIG_CACHE=$(npm config get cache)" >> "$GITHUB_ENV"
echo "npm_config_cache=$(npm config get cache)" >> "$GITHUB_OUTPUT"
- name: Cache npm packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ steps.get-npm-cache.outputs.npm_config_cache }}
key: npm-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: npm-${{ runner.os }}-${{ runner.arch }}
- name: Cache Puppeteer
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/puppeteer/
key: puppeteer-${{ runner.os }}-${{ runner.arch }}-${{ env.PUPPETEER_VERSION }}
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Test
run: npm run test
publish:
runs-on: ubuntu-24.04
timeout-minutes: 15
needs: validate
environment: npm-publish
permissions:
contents: read
id-token: write
env:
PUPPETEER_VERSION: 25.2.1
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Use Node.js LTS
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
registry-url: https://registry.npmjs.org
node-version: lts/*
- name: Get npm cache location
id: get-npm-cache
shell: bash
run: |
echo "NPM_CONFIG_CACHE=$(npm config get cache)" >> "$GITHUB_ENV"
echo "npm_config_cache=$(npm config get cache)" >> "$GITHUB_OUTPUT"
- name: Cache npm packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ steps.get-npm-cache.outputs.npm_config_cache }}
key: npm-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: npm-${{ runner.os }}-${{ runner.arch }}
- name: Cache Puppeteer
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/puppeteer/
key: puppeteer-${{ runner.os }}-${{ runner.arch }}-${{ env.PUPPETEER_VERSION }}
- name: Install dependencies
run: npm ci
- name: Stamp version
run: npm version "${GITHUB_REF_NAME}" --allow-same-version --no-git-tag-version
- name: Dry-run publish
run: npm publish --dry-run
- name: Publish with provenance
run: npm publish --provenance