File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed
Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ on :
2+ push :
3+ branches :
4+ - develop
5+
6+ name : Publish to NPM
7+
8+ jobs :
9+ publish :
10+ name : Publish
11+ runs-on : ubuntu-latest
12+ environment : dev
13+ steps :
14+ - uses : actions/checkout@v3
15+ - name : Use Node.js 18
16+ uses : actions/setup-node@v3
17+ with :
18+ node-version : ' 18.x'
19+ always-auth : true
20+ - name : Install Yarn
21+ run : npm install -g yarn
22+ - name : Bump version
23+ id : version
24+ run : |
25+ CURRENT_VERSION=$(jq -r '.version' package.json)
26+
27+ BASE_VERSION=$(echo $CURRENT_VERSION | cut -d '-' -f 1)
28+
29+ NEW_BASE=$(echo $BASE_VERSION | awk -v OFS='.' -F. '{
30+ $2 = $2 + 1;
31+ $3 = 0;
32+ print $0
33+ }')
34+
35+ TIMESTAMP=$(date -u +"%Y%m%d%H%M%S")
36+
37+ COMMIT_SHA=$(git rev-parse --short HEAD)
38+
39+ NEW_VERSION="${NEW_BASE}-dev.${TIMESTAMP}.${COMMIT_SHA}"
40+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
41+ - name : Update package.json version
42+ run : |
43+ jq ".version = \"${{ steps.version.outputs.new_version }}\"" package.json > package.tmp
44+ mv package.tmp package.json
45+ - name : Install dependencies
46+ run : yarn
47+ - name : Test
48+ run : yarn test
49+ - name : Build
50+ run : yarn build
51+ - name : Setup .yarnrc.yml
52+ run : |
53+ yarn config set npmAuthToken $NPM_AUTH_TOKEN
54+ yarn config set npmAlwaysAuth true
55+ env :
56+ NPM_AUTH_TOKEN : ${{ secrets.NPM_AUTH_TOKEN }}
57+ - name : Publish
58+ run : yarn npm publish --access public --tag dev
You can’t perform that action at this time.
0 commit comments