forked from lando/core
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (80 loc) · 3.39 KB
/
deploy-npm.yml
File metadata and controls
85 lines (80 loc) · 3.39 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
name: Deploy npm
on:
workflow_call:
inputs:
node-version:
default: "20"
description: The node version to use
required: false
type: string
secrets:
github-token:
description: "The github token"
required: true
jobs:
deploy-npm:
runs-on: ubuntu-24.04
env:
TERM: xterm
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install node ${{ inputs.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.node-version }}
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile
- name: Lint code
run: npm run lint
- name: Run unit tests
run: npm run test:unit
#- name: Update edge release alias
# shell: bash
# run: |
# if ./scripts/semcompare.sh "${{ github.event.release.tag_name }}" "$(cat ./release-aliases/3-EDGE)"; then
# echo "${{ github.event.release.tag_name }}" > ./release-aliases/3-EDGE
# fi
#- name: Update stable release alias
# shell: bash
# if: github.event.release.prerelease == false
# run: |
# if ./scripts/semcompare.sh "${{ github.event.release.tag_name }}" "$(cat ./release-aliases/3-STABLE)"; then
# echo "${{ github.event.release.tag_name }}" > ./release-aliases/3-STABLE
# fi
- name: Prepare Release
uses: lando/prepare-release-action@v3
with:
lando-plugin: true
sync: false
- name: Upgrade npm for trusted publishing
run: npm install -g "npm@^11.5.1"
- 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 --tag latest --dry-run
npm publish --access public --tag latest
# npm dist-tag add "$PACKAGE@$VERSION" edge # not supported with trusted publishing
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
#- name: Update edge release alias on main
# if: github.event.release.target_commitish == 'edge'
# run: |
# git clone https://github.com/lando/core.git core
# cd core
# git config user.name "rtfm-47"
# git config user.email "rtfm47@lando.dev"
# echo "${{ github.event.release.tag_name }}" > ./release-aliases/3-EDGE
# git add .
# git commit -m "Update edge release alias to ${{ github.event.release.tag_name }} triggered by @rtfm-47"
# git push https://x-access-token:${{ secrets.github-token }}@github.com/lando/core.git main