@@ -68,206 +68,6 @@ jobs:
6868 });
6969 }
7070
71- changeset :
72- permissions :
73- contents : write
74- pull-requests : write
75- name : Version with Changeset
76- runs-on : ubuntu-24.04-arm
77- if : |
78- github.event_name == 'push' ||
79- github.event_name == 'workflow_dispatch'
80- outputs :
81- hasChangesets : ${{ steps.changeset-check.outputs.hasChangesets }}
82- newVersion : ${{ steps.version.outputs.newVersion }}
83- currentVersion : ${{ steps.current-version.outputs.currentVersion }}
84- steps :
85- - uses : actions/checkout@v4
86- with :
87- fetch-depth : 0
88- # For PR comments, checkout the PR branch
89- ref : ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request.head.ref || github.ref }}
90-
91- - uses : pnpm/action-setup@v4
92- name : Install pnpm
93- with :
94- run_install : false
95-
96- - uses : actions/setup-node@v4
97- with :
98- node-version : 24
99- cache : " pnpm"
100-
101- - name : Configure Git
102- run : |
103- git config user.email "github-actions@users.noreply.github.com"
104- git config user.name "GitHub Actions"
105-
106- - name : Install dependencies
107- run : pnpm install --frozen-lockfile
108-
109- - name : Check for changesets
110- id : changeset-check
111- run : |
112- if [ -z "$(ls .changeset/*.md 2>/dev/null | grep -v README)" ]; then
113- echo "hasChangesets=false" >> "$GITHUB_OUTPUT"
114- echo "⚠️ No changesets found. Skipping version bump."
115- else
116- echo "hasChangesets=true" >> "$GITHUB_OUTPUT"
117- echo "✅ Changesets found. Proceeding with version bump."
118- fi
119-
120- - name : Version packages
121- if : steps.changeset-check.outputs.hasChangesets == 'true'
122- id : version
123- run : |
124- pnpm changeset version
125- NEW_VERSION=$(node -p "require('./package.json').version")
126- echo "newVersion=$NEW_VERSION" >> "$GITHUB_OUTPUT"
127- echo "📦 New version: $NEW_VERSION"
128-
129- - name : Get current version (if no changesets)
130- if : steps.changeset-check.outputs.hasChangesets == 'false'
131- id : current-version
132- run : |
133- CURRENT_VERSION=$(node -p "require('./package.json').version")
134- echo "currentVersion=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
135- echo "📦 Current version: $CURRENT_VERSION"
136-
137- # Only auto-commit on push to main
138- - name : Commit and Push (with version bump)
139- if : ${{ github.event_name == 'push' && steps.changeset-check.outputs.hasChangesets == 'true' }}
140- run : |
141- git add .
142- git commit -m "chore(release): v$NEW_VERSION"
143- git tag v$NEW_VERSION
144- git push
145- git push --tags
146- env :
147- NEW_VERSION : ${{ steps.version.outputs.newVersion }}
148-
149- build :
150- name : Build
151- runs-on : ubuntu-24.04-arm
152- needs : [changeset]
153- if : |
154- github.event_name == 'workflow_dispatch' ||
155- (github.event_name == 'issue_comment' && needs.check_comment.outputs.should_release == 'true')
156- steps :
157- - uses : actions/checkout@v4
158- with :
159- fetch-depth : 0
160- ref : ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request.head.ref || github.ref }}
161-
162- - uses : pnpm/action-setup@v4
163- name : Install pnpm
164- with :
165- run_install : false
166-
167- - uses : actions/setup-node@v4
168- with :
169- node-version : 24
170- cache : " pnpm"
171-
172- - name : Install dependencies
173- run : pnpm install --frozen-lockfile
174-
175- - name : Build and Zip
176- run : |
177- pnpm run zip:all
178-
179- - name : Upload Artifacts
180- uses : actions/upload-artifact@v4
181- with :
182- name : extension-build-${{ github.run_number }}
183- path : dist/*.zip
184- if-no-files-found : error
185- include-hidden-files : true
186-
187- release :
188- name : Create Release
189- runs-on : ubuntu-24.04-arm
190- needs : [changeset, build]
191- if : |
192- (github.event_name == 'workflow_dispatch' && inputs.action == 'release') ||
193- (github.event_name == 'issue_comment' && needs.check_comment.outputs.should_release == 'true')
194- steps :
195- - name : Download build artifacts
196- uses : actions/download-artifact@v4
197- with :
198- name : extension-build-${{ github.run_number }}
199- path : dist/
200-
201- - name : Create GitHub Release (with version bump)
202- if : ${{ needs.changeset.outputs.hasChangesets == 'true' }}
203- uses : softprops/action-gh-release@v1
204- with :
205- tag_name : v${{ needs.changeset.outputs.newVersion }}
206- name : Release v${{ needs.changeset.outputs.newVersion }}
207- body : |
208- ## Changes
209-
210- Check the [CHANGELOG.md](./CHANGELOG.md) for detailed changes.
211-
212- ## Extension Files
213- - Chrome: `amgiflol-${{ needs.changeset.outputs.newVersion }}-chrome.zip`
214- - Firefox: `amgiflol-${{ needs.changeset.outputs.newVersion }}-firefox.zip`
215- files : |
216- dist/*-chrome.zip
217- dist/*-firefox.zip
218- draft : false
219- prerelease : false
220-
221- - name : Create GitHub Release (no version bump)
222- if : ${{ needs.changeset.outputs.hasChangesets == 'false' }}
223- uses : softprops/action-gh-release@v1
224- with :
225- tag_name : v${{ needs.changeset.outputs.currentVersion }}-build-${{ github.run_number }}
226- name : Build v${{ needs.changeset.outputs.currentVersion }}-build-${{ github.run_number }}
227- body : |
228- ## Build Release
229-
230- This is a build release without version changes.
231-
232- ## Extension Files
233- - Chrome: `amgiflol-${{ needs.changeset.outputs.currentVersion }}-chrome.zip`
234- - Firefox: `amgiflol-${{ needs.changeset.outputs.currentVersion }}-firefox.zip`
235- files : |
236- dist/*-chrome.zip
237- dist/*-firefox.zip
238- draft : false
239- prerelease : true
240-
241- - name : Comment on PR (if triggered by comment)
242- if : github.event_name == 'issue_comment'
243- uses : actions/github-script@v7
244- with :
245- script : |
246- const hasChangesets = '${{ needs.changeset.outputs.hasChangesets }}' === 'true';
247- const version = hasChangesets ? '${{ needs.changeset.outputs.newVersion }}' : '${{ needs.changeset.outputs.currentVersion }}';
248- const releaseUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/releases/tag/v${version}${hasChangesets ? '' : '-build-' + context.runNumber}`;
249-
250- let body = '## 🚀 Release Created Successfully!\n\n';
251- body += `📦 **Version**: \`v${version}${hasChangesets ? '' : '-build-' + context.runNumber}\`\n`;
252- body += `🔗 **Release URL**: ${releaseUrl}\n\n`;
253-
254- if (hasChangesets) {
255- body += `✅ **Full release** with version bump and changelog updates\n`;
256- } else {
257- body += `⚠️ **Build release** without version changes (marked as prerelease)\n`;
258- }
259-
260- body += `\n📁 **Extension files are attached to the release**\n`;
261- body += `- Chrome: \`amgiflol-${version}-chrome.zip\`\n`;
262- body += `- Firefox: \`amgiflol-${version}-firefox.zip\``;
263-
264- await github.rest.issues.createComment({
265- issue_number: context.issue.number,
266- owner: context.repo.owner,
267- repo: context.repo.repo,
268- body: body
269- });
270-
27171 submit :
27272 name : Submit to Stores
27373 runs-on : ubuntu-24.04-arm
0 commit comments