@@ -3,9 +3,7 @@ name: CI/CD
33
44on :
55 workflow_dispatch : # Allows you to run this workflow manually from the Actions tab
6- pull_request : # Runs whenever a pull request is created or updated
76 push : # Runs whenever a commit is pushed to the repository
8- branches : [master, develop, hotfix/*]
97
108concurrency :
119 group : " ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
@@ -40,42 +38,14 @@ jobs:
4038 GitHub head ref: ${{ github.head_ref }}
4139 EOF
4240
43- - name : Setup & Test
44- run : |
45- npm ci
46- npm run test
41+ - run : npm ci
4742
48- - name : Generate release version
49- run : |
50- export NODE_ENV=production
51- export RELEASE_TIMESTAMP=$(date +'%Y%m%d%H%M%S')
52- export VPKG=$($(npm bin)/json -f package.json version)
53- export VERSION=${VPKG}-prerelease.${RELEASE_TIMESTAMP}
54- echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_ENV
55- if [[ "${GITHUB_REF##*/}" == hotfix/* ]]; then
56- echo "NPM_TAG=hotfix" >> $GITHUB_ENV
57- else
58- echo "NPM_TAG=latest" >> $GITHUB_ENV
59- fi
43+ - run : npm test
6044
61- - name : Build
62- run : |
63- npm run build
64- npm --no-git-tag-version version $RELEASE_VERSION
45+ - run : npm run build
6546
66- - name : Deploy to NPM (do a dry-run if not on master, develop, or hotfix/*)
47+ - name : Run semantic-release
6748 env :
6849 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
69- NPM_TAG : ${{ env.NPM_TAG }}
70- run : |
71- message=$([[ "$TRIGGER_DEPLOY" == "false" ]] && echo "DRY RUN of" || echo "Deploying")
72- echo "$message version $RELEASE_VERSION to $NPM_TAG"
73- npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
74- npm publish --tag $NPM_TAG $([[ "$TRIGGER_DEPLOY" == "false" ]] && echo "--dry-run")
75-
76- - name : Check Release Version and Create Tag
77- run : |
78- if npm info | grep -q $RELEASE_VERSION; then
79- git tag $RELEASE_VERSION
80- git push origin $RELEASE_VERSION
81- fi
50+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
51+ run : npx --no -- semantic-release
0 commit comments