@@ -3,7 +3,7 @@ name: Release
33on :
44 pull_request :
55 types : [closed]
6- branches : ["main"]
6+ branches : ["main", "next" ]
77
88permissions :
99 contents : write
@@ -12,7 +12,7 @@ permissions:
1212jobs :
1313 release :
1414 name : Release Amicons
15- if : github.event.pull_request.merged == true
15+ if : github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
1616 runs-on : ubuntu-latest
1717 steps :
1818 - name : Checkout
@@ -47,11 +47,64 @@ jobs:
4747 - name : Create GitHub release
4848 run : |
4949 gh release create v${{ steps.version.outputs.version }} \
50- --title "v ${{ steps.version.outputs.version }}" \
50+ --title "${{ github.event.pull_request.title }}" \
5151 --notes-file release-notes.md \
5252 "amicons-${{ steps.version.outputs.version }}-icons.zip#Amicons icons v${{ steps.version.outputs.version }}"
5353 env :
5454 GH_TOKEN : ${{ github.token }}
5555 - name : Publish to npm
5656 working-directory : amicons
5757 run : pnpm publish --no-git-checks --access public --provenance
58+
59+ prerelease :
60+ name : Prerelease Amicons
61+ if : github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'next'
62+ runs-on : ubuntu-latest
63+ steps :
64+ - name : Checkout
65+ uses : actions/checkout@v6
66+ - name : Get version
67+ id : version
68+ run : echo "version=$(jq -r '.version' amicons/package.json)" >> $GITHUB_OUTPUT
69+ - name : Set prerelease metadata
70+ id : meta
71+ run : |
72+ echo "tag=v${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT
73+ echo "label=v${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT
74+ - name : Set up pnpm
75+ uses : pnpm/action-setup@v5
76+ with :
77+ version : 10.33.0
78+ - name : Set up Node 24
79+ uses : actions/setup-node@v6
80+ with :
81+ node-version : 24.x
82+ cache : " pnpm"
83+ cache-dependency-path : amicons/pnpm-lock.yaml
84+ registry-url : " https://registry.npmjs.org"
85+ - name : Install dependencies
86+ working-directory : amicons
87+ run : pnpm install --frozen-lockfile
88+ - name : Production build
89+ working-directory : amicons
90+ run : pnpm prod
91+ - name : Package icons
92+ working-directory : amicons
93+ run : zip -r ../amicons-${{ steps.meta.outputs.label }}-icons.zip icons -i "*.svg"
94+
95+ - name : Write release notes
96+ env :
97+ BODY : ${{ github.event.pull_request.body }}
98+ run : echo "$BODY" > release-notes.md
99+ - name : Create GitHub prerelease
100+ run : |
101+ gh release create ${{ steps.meta.outputs.tag }} \
102+ --title "${{ github.event.pull_request.title }}" \
103+ --prerelease \
104+ --notes-file release-notes.md \
105+ "amicons-${{ steps.meta.outputs.label }}-icons.zip#Amicons icons ${{ steps.meta.outputs.label }}"
106+ env :
107+ GH_TOKEN : ${{ github.token }}
108+ - name : Publish to npm (next)
109+ working-directory : amicons
110+ run : pnpm publish --no-git-checks --access public --provenance --tag next
0 commit comments