forked from TryGhost/node-sqlite3
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (54 loc) · 1.59 KB
/
publish.yml
File metadata and controls
63 lines (54 loc) · 1.59 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
name: Publish to npm
on:
workflow_dispatch:
inputs:
tag:
description: 'The release tag to publish (e.g. v6.4.0)'
required: true
type: string
npm_tag:
description: 'npm dist-tag (e.g. next, beta). Leave empty for latest.'
required: false
type: string
default: ''
permissions:
contents: write
id-token: write
env:
FORCE_COLOR: 1
DEFAULT_NODE_VERSION: '24'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Validate tag input
run: |
if [ -z "${{ inputs.tag }}" ]; then
echo "ERROR: tag input is required"
exit 1
fi
echo "Publishing release: ${{ inputs.tag }}"
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
registry-url: https://registry.npmjs.org
- name: Download tarball from GitHub Release
run: |
gh release download ${{ inputs.tag }} --pattern '*.tgz' --dir .
echo "Downloaded tarball:"
ls -la *.tgz
env:
GH_TOKEN: ${{ github.token }}
- name: Publish to npm
run: |
TARBALL=$(ls *.tgz | head -1)
if [ -n "${{ inputs.npm_tag }}" ]; then
npm publish "$TARBALL" --access public --tag ${{ inputs.npm_tag }}
else
npm publish "$TARBALL" --access public
fi
- name: Mark release as not pre-release
run: gh release edit ${{ inputs.tag }} --draft=false
env:
GH_TOKEN: ${{ github.token }}