-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (62 loc) · 2.3 KB
/
release.yml
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
name: Publish to NPM
on:
release:
types:
- published
- edited
jobs:
deploy:
runs-on: ${{ matrix.os }}
env:
TERM: xterm
strategy:
matrix:
os:
- ubuntu-24.04
node-version:
- '20'
steps:
# Install deps and cache
- name: Checkout code
uses: actions/checkout@v4
- name: Install node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile
# Let's do tests rq just to make sure we dont push something that is fundamentally broken
- name: Lint code
run: npm run lint
- name: Run unit tests
run: npm run test:unit
# Prepare release.
- name: Prepare release
uses: lando/prepare-release-action@v3
with:
lando-plugin: true
sync-email: rtfm47@lando.dev
sync-token: ${{ secrets.RTFM47_COAXIUM_INJECTOR }}
sync-username: rtfm-47
# Deploy
- name: Publish to npm
run: |
VERSION=$(node -p "require('./package.json').version")
PACKAGE=$(node -p "require('./package.json').name")
if [ "${{ github.event.release.prerelease }}" == "false" ]; then
npm publish --access public --dry-run
npm publish --access public
npm dist-tag add "$PACKAGE@$VERSION" edge
echo "::notice title=Published $VERSION to $PACKAGE::This is a stable release published to the default 'latest' npm tag"
echo "::notice title=Updated latest tag to $VERSION::The stable tag now points to $VERSION"
echo "::notice title=Updated edge tag to $VERSION::The edge tag now points to $VERSION"
else
npm publish --access public --tag edge --dry-run
npm publish --access public --tag edge
echo "::notice title=Published $VERSION to $PACKAGE::This is a prerelease published to the 'edge' npm tag"
echo "::notice title=Updated edge tag to $VERSION::The edge tag now points to $VERSION"
fi
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_DEPLOY_TOKEN}}