File tree Expand file tree Collapse file tree 1 file changed +69
-0
lines changed
Expand file tree Collapse file tree 1 file changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ pull_request :
5+ types : [closed]
6+ branches :
7+ - main
8+
9+ permissions :
10+ contents : write
11+
12+ jobs :
13+ release :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v4
19+
20+ - name : Set up Node.js
21+ uses : actions/setup-node@v4
22+ with :
23+ node-version : 20
24+ cache : yarn
25+
26+ - name : Configure Git
27+ run : |
28+ git config user.name "github-actions"
29+ git config user.email "[email protected] " 30+
31+ - name : Install dependencies
32+ run : yarn install --frozen-lockfile
33+
34+ - name : Generate version from date
35+ id : generate_version
36+ run : |
37+ VERSION="v$(date +'%Y.%m.%d' | sed 's/0//g')"
38+ echo "VERSION=$VERSION" >> $GITHUB_ENV
39+ echo "Generated version: $VERSION"
40+
41+ - name : Update version in package.json
42+ run : |
43+ jq --arg new_version "${{ env.VERSION }}" '.version = $new_version' package.json > temp.json && mv temp.json package.json
44+ echo "Updated package.json to version: ${{ env.VERSION }}"
45+
46+ - name : Commit updated package.json
47+ run : |
48+ git add package.json
49+ git commit -m "chore: update version to ${{ env.VERSION }}"
50+ git push origin main
51+
52+ - name : Create Git tag
53+ run : |
54+ git tag -a "${{ env.VERSION }}" -m "Release ${{ env.VERSION }}"
55+ git push origin "${{ env.VERSION }}"
56+
57+ - name : Build the package
58+ run : yarn build
59+
60+ - name : Notify release
61+ run : echo "Release ${{ env.VERSION }} has been successfully created."
62+
63+ - name : Set up NPM auth
64+ run : echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
65+
66+ - name : Publish to npm
67+ run : yarn publish --non-interactive
68+ env :
69+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments