Repository navigation
44 lines (40 loc) · 1.5 KB
/
Copy pathrelease.yml
File metadata and controls
44 lines (40 loc) · 1.5 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
name: Release
# Publishes to npm with provenance, so anyone can verify that a published
# version was built from this repository at a given commit. Runs only when
# started by hand. Before the first run, add this repository and workflow as a
# trusted publisher for @databuddy/setup-agent on npmjs.com; no npm token is
# stored here.
on:
workflow_dispatch:
permissions:
contents: read
id-token: write
concurrency:
group: release
cancel-in-progress: false
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '24'
cache: pnpm
registry-url: 'https://registry.npmjs.org'
- run: pnpm install --frozen-lockfile
- run: pnpm validate
- name: Skip versions that are already published
id: version
run: |
version=$(node -p "require('./package.json').version")
if npm view "@databuddy/setup-agent@$version" version >/dev/null 2>&1; then
echo "Version $version is already on npm; nothing to publish."
echo "publish=false" >> "$GITHUB_OUTPUT"
else
echo "publish=true" >> "$GITHUB_OUTPUT"
fi
- if: steps.version.outputs.publish == 'true'
run: npm publish --provenance --access public