@@ -2,9 +2,7 @@ name: CI/CD
2
2
3
3
on :
4
4
workflow_dispatch : # Allows you to run this workflow manually from the Actions tab
5
- pull_request : # Runs whenever a pull request is created or updated
6
5
push : # Runs whenever a commit is pushed to the repository
7
- branches : [master, develop, hotfix/*]
8
6
9
7
concurrency :
10
8
group : " ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
@@ -50,38 +48,14 @@ jobs:
50
48
mkdir -p ./test/results
51
49
npm test
52
50
53
- - name : Generate release version
54
- run : |
55
- export RELEASE_TIMESTAMP=$(date +'%Y%m%d%H%M%S')
56
- export VPKG=$($(npm bin)/json -f package.json version)
57
- export VERSION=${VPKG}-prerelease.${RELEASE_TIMESTAMP}
58
-
59
- echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_ENV
60
-
61
- if [[ "${GITHUB_REF##*/}" == hotfix/* ]]; then
62
- echo "NPM_TAG=hotfix" >> $GITHUB_ENV
63
- else
64
- echo "NPM_TAG=latest" >> $GITHUB_ENV
65
- fi
51
+ - run : npm run build
66
52
67
- - name : Build
68
- run : |
69
- npm run build
70
- npm --no-git-tag-version version $RELEASE_VERSION
71
-
72
- - name : Deploy to NPM (do a dry-run if not on master, develop, or hotfix/*)
53
+ - name : Run semantic-release
73
54
env :
74
55
NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
75
- NPM_TAG : ${{ env.NPM_TAG }}
76
- run : |
77
- message=$([[ "$TRIGGER_DEPLOY" == "false" ]] && echo "DRY RUN of" || echo "Deploying")
78
- echo "$message version $RELEASE_VERSION to $NPM_TAG"
79
- npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
80
- npm publish --tag $NPM_TAG $([[ "$TRIGGER_DEPLOY" == "false" ]] && echo "--dry-run")
81
-
82
- - name : Check Release Version and Create Tag
56
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
83
57
run : |
84
- if npm info | grep -q $RELEASE_VERSION; then
85
- git tag $RELEASE_VERSION
86
- git push origin $RELEASE_VERSION
58
+ if [[ ${{contains(github.ref, 'hotfix/')}} ]]; then
59
+ sed -e "s|hotfix/REPLACE|${{ github.ref_name }}|" --in-place release.config.js
87
60
fi
61
+ npx --no -- semantic-release
0 commit comments