-
-
Notifications
You must be signed in to change notification settings - Fork 315
50 lines (41 loc) · 1.39 KB
/
deploy-manager.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
name: Deploy Management Action
on:
push:
branches:
- release
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "12"
registry-url: "https://registry.npmjs.org/"
- name: Check if version has been updated
id: check-version
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
LAST_GIT_TAG=$(git describe --tags --abbrev=0)
if [ "v$PACKAGE_VERSION" == "$LAST_GIT_TAG" ]; then
echo "Package version ($PACKAGE_VERSION) has not been updated since the last tag ($LAST_GIT_TAG)."
exit 1
else
echo "Package version has been updated to $PACKAGE_VERSION."
echo "::set-output name=package_version::$PACKAGE_VERSION"
fi
- name: Install dependencies
run: npm install && npm audit fix
- name: Build
run: npm run build
- name: Deploy
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Execute script for milestone
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION_NAME: ${{ steps.check-version.outputs.package_version }}
run: node .github/scripts/manage-deploy.js $VERSION_NAME