-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (47 loc) · 1.41 KB
/
deploy.yml
File metadata and controls
53 lines (47 loc) · 1.41 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
name: Automated deploy
on:
push:
tags:
- 'v*'
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
project_version: ${{ steps.project_version.outputs.value }}
project: ${{ steps.project.outputs.value }}
steps:
- id: project_version
run: |
VERSION=${GITHUB_REF/refs\/tags\//}
SANITIZED_VERSION=${VERSION#v}
if ! [[ "$SANITIZED_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format: $SANITIZED_VERSION"
exit 1
fi
echo ::set-output name=value::$SANITIZED_VERSION
- id: project
run: echo ::set-output name=value::$(echo ${GITHUB_REPOSITORY#*/} | tr A-Z a-z)
deploy:
runs-on: ubuntu-latest
needs: prepare
env:
PROJECT: ${{ needs.prepare.outputs.project }}
VERSION: ${{ needs.prepare.outputs.project_version }}
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GPR_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: node --version
- run: npm --version
- run: npm install -g npm@10
- run: npm cache clean --force
- run: npm version --no-git-tag-version "$VERSION"
- run: npm ci -q
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}