1- name : Canary version Release
2-
3- on :
4- pull_request :
5- types : [closed]
6- branches :
7- - develop
8-
9- jobs :
10- release :
11- if : |
12- github.event.pull_request.merged == true &&
13- contains(github.event.pull_request.labels.*.name, 'release')
14- runs-on : ubuntu-latest
15-
16- permissions :
17- contents : write
18- packages : write
19-
20- steps :
21- - name : Checkout code
22- uses : actions/checkout@v5
23-
24- - name : Setup pnpm
25- uses : pnpm/action-setup@v4
26- with :
27- run_install : false
28-
29- - name : Setup Node.js
30- uses : actions/setup-node@v4
31- with :
32- node-version : 22
33- cache : ' pnpm'
34- registry-url : ' https://registry.npmjs.org'
35-
36- - name : Install dependencies
37- run : pnpm install
38-
39- - name : Get version and SHA
40- id : version
41- run : |
42- PACKAGE_VERSION=$(node -p "require('./package.json').version")
43- SHORT_SHA=$(git rev-parse --short HEAD)
44- VERSION_NUM=""
45- VERSION="${PACKAGE_VERSION}-canary-${SHORT_SHA}"
46- echo "version=${VERSION}" >> $GITHUB_OUTPUT
47-
48- - name : Create and push tag
49- run : |
50- git config user.name "GitHub Actions"
51- git config user.email "[email protected] " 52- git tag -a "${{ steps.version.outputs.version }}" -m "Canary release ${{ steps.version.outputs.version }}"
53- git push origin "${{ steps.version.outputs.version }}"
54-
55- - name : Prepare release contents
56- id : release_contents
57- run : |
58- cat << 'EOF' > pr_body.txt
59- # 🚀 New Canary Release (`${{ steps.version.outputs.version }}`)
60-
61- EOF
62-
63- cat << 'EOF' > pr_body.txt
64- ${{ github.event.pull_request.body }}
65- EOF
66-
67- cat << 'EOF' >> pr_body.txt
68-
69- ## 📦 Installation
70- ```bash
71- npm install --dev @repixelcorp/hyper-pwt@${{ steps.version.outputs.version }}
72- ```
73-
74- ## ⚠️ Warning
75- This is a canary release and should not be used in production environments.
76-
77- EOF
78-
79- echo "body<<EOF" >> $GITHUB_OUTPUT
80- cat pr_body.txt >> $GITHUB_OUTPUT
81- echo "EOF" >> $GITHUB_OUTPUT
82-
83- - name : Create GitHub Release
84- id : create_release
85- uses : actions/create-release@v1
86- env :
87- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
88- with :
89- tag_name : ${{ steps.version.outputs.version }}
90- release_name : 🚀 ${{ steps.version.outputs.version }}
91- body : ${{ steps.release_contents.outputs.body }}
92- draft : false
93- prerelease : true
94-
95- - name : Update package.json version
96- run : |
97- npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version
98-
99- - name : Build package
100- run : pnpm build
101-
102- - name : Publish to NPM
103- run : |
104- npm publish --tag canary --access public
105- env :
1+ name : Canary version Release
2+
3+ on :
4+ pull_request :
5+ types : [closed]
6+ branches :
7+ - develop
8+
9+ jobs :
10+ release :
11+ if : |
12+ github.event.pull_request.merged == true &&
13+ contains(github.event.pull_request.labels.*.name, 'release')
14+ runs-on : ubuntu-latest
15+
16+ permissions :
17+ contents : write
18+ packages : write
19+
20+ steps :
21+ - name : Checkout code
22+ uses : actions/checkout@v5
23+
24+ - name : Setup pnpm
25+ uses : pnpm/action-setup@v4
26+ with :
27+ run_install : false
28+
29+ - name : Setup Node.js
30+ uses : actions/setup-node@v4
31+ with :
32+ node-version : 22
33+ cache : ' pnpm'
34+ registry-url : ' https://registry.npmjs.org'
35+
36+ - name : Install dependencies
37+ run : pnpm install
38+
39+ - name : Get version and SHA
40+ id : version
41+ run : |
42+ PACKAGE_VERSION=$(node -p "require('./package.json').version")
43+ SHORT_SHA=$(git rev-parse --short HEAD)
44+ VERSION_NUM=""
45+ VERSION="${PACKAGE_VERSION}-canary-${SHORT_SHA}"
46+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
47+
48+ - name : Create and push tag
49+ run : |
50+ git config user.name "GitHub Actions"
51+ git config user.email "[email protected] " 52+ git tag -a "${{ steps.version.outputs.version }}" -m "Canary release ${{ steps.version.outputs.version }}"
53+ git push origin "${{ steps.version.outputs.version }}"
54+
55+ - name : Prepare release contents
56+ id : release_contents
57+ run : |
58+ cat << 'EOF' > pr_body.txt
59+ # 🚀 New Canary Release (`${{ steps.version.outputs.version }}`)
60+
61+ EOF
62+
63+ cat << 'EOF' > pr_body.txt
64+ ${{ github.event.pull_request.body }}
65+ EOF
66+
67+ cat << 'EOF' >> pr_body.txt
68+
69+ ## 📦 Installation
70+ ```bash
71+ npm install --dev @repixelcorp/hyper-pwt@${{ steps.version.outputs.version }}
72+ ```
73+
74+ ## ⚠️ Warning
75+ This is a canary release and should not be used in production environments.
76+
77+ EOF
78+
79+ echo "body<<EOF" >> $GITHUB_OUTPUT
80+ cat pr_body.txt >> $GITHUB_OUTPUT
81+ echo "EOF" >> $GITHUB_OUTPUT
82+
83+ - name : Create GitHub Release
84+ id : create_release
85+ uses : actions/create-release@v1
86+ env :
87+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
88+ with :
89+ tag_name : ${{ steps.version.outputs.version }}
90+ release_name : 🚀 ${{ steps.version.outputs.version }}
91+ body : ${{ steps.release_contents.outputs.body }}
92+ draft : false
93+ prerelease : true
94+
95+ - name : Update package.json version
96+ run : |
97+ npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version
98+
99+ - name : Build package
100+ run : pnpm build
101+
102+ - name : Publish to NPM
103+ run : |
104+ npm publish --tag canary --access public
105+ env :
106106 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments