File tree 1 file changed +61
-0
lines changed
1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish to NPM Dev Channel
2
+
3
+ on :
4
+ workflow_dispatch
5
+
6
+ jobs :
7
+ build-and-publish :
8
+ runs-on : ubuntu-latest
9
+
10
+ steps :
11
+ - name : Checkout code
12
+ uses : actions/checkout@v4
13
+ with :
14
+ fetch-depth : 0
15
+
16
+ - name : Check branch
17
+ run : |
18
+ if [ "$GITHUB_REF" != "refs/heads/develop" ]; then
19
+ echo "This workflow can only be run on the 'develop' branch."
20
+ exit 1
21
+ fi
22
+
23
+ - name : Set up Node.js
24
+ uses : actions/setup-node@v4
25
+ with :
26
+ node-version : 18
27
+ registry-url : https://registry.npmjs.org/
28
+
29
+ - name : Install dependencies
30
+ run : npm install
31
+
32
+ - name : Build project
33
+ run : npm run build
34
+
35
+ - name : Update package version
36
+ id : update-version
37
+ run : |
38
+ CURRENT_VERSION=$(node -p "require('./package.json').version")
39
+ TIMESTAMP=$(date -u +"%Y%m%d%H%M%S")
40
+ NEW_VERSION="${CURRENT_VERSION}-dev${TIMESTAMP}"
41
+ npm version --no-git-tag-version $NEW_VERSION
42
+ echo "New version: $NEW_VERSION"
43
+ echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
44
+
45
+ - name : Update package-lock.json
46
+ run : npm install
47
+
48
+ - name : Commit version update
49
+ run : |
50
+ git config --global user.name "GitHub Actions"
51
+ git config --global user.email "actions@github.com"
52
+ git add package.json package-lock.json
53
+ git commit -m "Update version to $NEW_VERSION [skip ci]"
54
+ git push origin develop
55
+ env :
56
+ GITHUB_TOKEN : ${{ secrets.PAT }}
57
+
58
+ - name : Publish to NPM Dev Channel
59
+ run : npm publish --tag dev
60
+ env :
61
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments