-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 1.96 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
71
72
73
74
name: Release
on: [workflow_call, workflow_dispatch]
env:
NODE_VERSION: 20
CI: true
jobs:
release:
name: Release
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Retrieve version
id: version
run: |
echo "TAG_NAME=$(git tag --points-at HEAD)" >> $GITHUB_OUTPUT
# - uses: actions-ecosystem/action-get-latest-tag@v1
# id: version
# - name: Validate version from git tag
# if: steps.version.outputs.is_valid != 'true'
# run: echo "Tag must follow SemVer convention. Aborting." && exit 1
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Assign dist tag
id: dist-tag
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const gitTag = '${{ steps.version.outputs.tag }}'
console.log(`git tag: ${gitTag}`)
if (gitTag.match(/^v\d+\.\d+\.\d+$/)) {
distTag = 'latest'
} else if (gitTag.match(/^v\d+\.\d+\.\d+/)) {
distTag = 'alpha'
} else {
core.setFailed('Tag must follow SemVer convention. Aborting.');
}
console.log(`npm dist tag: ${distTag}`)
return distTag
- name: Install
run: |
corepack enable
yarn install
- name: Build
run: |
yarn lint
yarn build
yarn test
- name: Configure yarn to publish packages
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_CARTODB_AUTH_TOKEN }}
run: |
yarn config set npmPublishRegistry "https://registry.npmjs.org/"
yarn config set npmAuthToken "${NPM_AUTH_TOKEN}"
- name: Publish
env:
DIST_TAG: ${{ steps.dist-tag.outputs.result }}
run: yarn npm publish --tag ${DIST_TAG}