2323 type : boolean
2424
2525jobs :
26- changeset-check :
26+ changeset_check :
2727 permissions :
2828 contents : write
2929 pull-requests : write
7171 fi
7272
7373 - name : Version packages
74- if : steps.changeset-check .outputs.hasChangesets == 'true'
74+ if : steps.changeset_check .outputs.hasChangesets == 'true'
7575 id : version
7676 run : |
7777 pnpm changeset version
@@ -80,16 +80,15 @@ jobs:
8080 echo "📦 New version: $NEW_VERSION"
8181
8282 - name : Get current version (if no changesets)
83- if : steps.changeset-check .outputs.hasChangesets == 'false'
83+ if : steps.changeset_check .outputs.hasChangesets == 'false'
8484 id : current-version
8585 run : |
8686 CURRENT_VERSION=$(node -p "require('./package.json').version")
8787 echo "currentVersion=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
8888 echo "📦 Current version: $CURRENT_VERSION"
8989
90- # Only auto-commit on push to main
9190 - name : Commit and Push (with version bump)
92- if : ${{ github.event_name == 'push' && steps.changeset-check.outputs.hasChangesets == 'true' }}
91+ if : ${{ steps.changeset-check.outputs.hasChangesets == 'true' }}
9392 run : |
9493 git add .
9594 git commit -m "chore(release): v$NEW_VERSION"
@@ -99,110 +98,90 @@ jobs:
9998 env :
10099 NEW_VERSION : ${{ steps.version.outputs.newVersion }}
101100
102- # release:
103- # needs: check-comment
104- # if: needs.check-comment.outputs.should_release == 'true'
105- # runs-on: ubuntu-latest
106-
107- # steps:
108- # - name: Get PR details
109- # id: pr
110- # uses: actions/github-script@v7
111- # with:
112- # script: |
113- # const { data: pr } = await github.rest.pulls.get({
114- # owner: context.repo.owner,
115- # repo: context.repo.repo,
116- # pull_number: context.issue.number
117- # });
118-
119- # core.setOutput('ref', pr.head.ref);
120- # core.setOutput('sha', pr.head.sha);
121-
122- # - name: Checkout PR branch
123- # uses: actions/checkout@v4
124- # with:
125- # ref: ${{ steps.pr.outputs.ref }}
126- # token: ${{ secrets.GITHUB_TOKEN }}
127-
128- # - name: Setup Node.js
129- # uses: actions/setup-node@v4
130- # with:
131- # node-version: '18'
132- # cache: 'npm'
133- # registry-url: 'https://registry.npmjs.org'
134-
135- # - name: Install dependencies
136- # run: npm ci
137-
138- # - name: Run final checks
139- # run: |
140- # npm run lint
141- # npm run build
142- # npm test
143-
144- # - name: Configure Git
145- # run: |
146- # git config user.name "github-actions[bot]"
147- # git config user.email "github-actions[bot]@users.noreply.github.com"
148-
149- # - name: Version bump
150- # run: |
151- # npm version ${{ needs.check-comment.outputs.release_type }} --no-git-tag-version
152- # echo "NEW_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
153-
154- # - name: Update changelog
155- # run: |
156- # # You can add changelog generation here
157- # # Example: npx conventional-changelog -p angular -i CHANGELOG.md -s
158- # echo "# Changelog updated for v${{ env.NEW_VERSION }}" >> CHANGELOG.md
159-
160- # - name: Commit changes
161- # run: |
162- # git add package.json package-lock.json CHANGELOG.md
163- # git commit -m "chore: release v${{ env.NEW_VERSION }}"
164- # git tag "v${{ env.NEW_VERSION }}"
165-
166- # - name: Push changes
167- # run: |
168- # git push origin ${{ steps.pr.outputs.ref }}
169- # git push origin "v${{ env.NEW_VERSION }}"
170-
171- # - name: Create GitHub Release
172- # uses: actions/github-script@v7
173- # with:
174- # script: |
175- # const { data: release } = await github.rest.repos.createRelease({
176- # owner: context.repo.owner,
177- # repo: context.repo.repo,
178- # tag_name: `v${{ env.NEW_VERSION }}`,
179- # name: `Release v${{ env.NEW_VERSION }}`,
180- # body: `## What's Changed\n\nReleased via PR #${{ github.event.issue.number }}`,
181- # draft: false,
182- # prerelease: false
183- # });
184-
185- # await github.rest.issues.createComment({
186- # issue_number: context.issue.number,
187- # owner: context.repo.owner,
188- # repo: context.repo.repo,
189- # body: `🎉 Release v${{ env.NEW_VERSION }} created successfully!\n\n[View Release](${release.html_url})`
190- # });
191-
192- # - name: Publish to npm
193- # if: env.NPM_TOKEN != ''
194- # run: npm publish
195- # env:
196- # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
197-
198- # - name: Merge PR automatically
199- # uses: actions/github-script@v7
200- # with:
201- # script: |
202- # await github.rest.pulls.merge({
203- # owner: context.repo.owner,
204- # repo: context.repo.repo,
205- # pull_number: context.issue.number,
206- # commit_title: `Release v${{ env.NEW_VERSION }}`,
207- # merge_method: 'squash'
208- # });
101+ build :
102+ name : Build
103+ runs-on : ubuntu-24.04-arm
104+ needs : [changeset_check]
105+ if : |
106+ github.event_name == 'push' ||
107+ github.event_name == 'workflow_dispatch'
108+ steps :
109+ - uses : actions/checkout@v4
110+ with :
111+ fetch-depth : 0
112+
113+ - uses : pnpm/action-setup@v4
114+ name : Install pnpm
115+ with :
116+ run_install : false
117+
118+ - uses : actions/setup-node@v4
119+ with :
120+ node-version : 24
121+ cache : " pnpm"
122+
123+ - name : Install dependencies
124+ run : pnpm install --frozen-lockfile
125+
126+ - name : Build and Zip
127+ run : |
128+ pnpm run zip:all
129+
130+ - name : Upload Artifacts
131+ uses : actions/upload-artifact@v4
132+ with :
133+ name : extension-build-${{ github.run_number }}
134+ path : dist/*.zip
135+ if-no-files-found : error
136+ include-hidden-files : false
137+
138+ release :
139+ name : Create Release
140+ runs-on : ubuntu-24.04-arm
141+ needs : [changeset_check, build]
142+ steps :
143+ - name : Download build artifacts
144+ uses : actions/download-artifact@v4
145+ with :
146+ name : extension-build-${{ github.run_number }}
147+ path : dist/
148+
149+ - name : Create GitHub Release (with version bump)
150+ if : ${{ steps.changeset.outputs.hasChangesets == 'true' }}
151+ uses : softprops/action-gh-release@v1
152+ with :
153+ tag_name : v${{ needs.changeset.outputs.newVersion }}
154+ name : Release v${{ needs.changeset.outputs.newVersion }}
155+ body : |
156+ ## Changes
157+
158+ Check the [CHANGELOG.md](./CHANGELOG.md) for detailed changes.
159+
160+ ## Extension Files
161+ - Chrome: `amgiflol-${{ needs.changeset.outputs.newVersion }}-chrome.zip`
162+ - Firefox: `amgiflol-${{ needs.changeset.outputs.newVersion }}-firefox.zip`
163+ files : |
164+ dist/*-chrome.zip
165+ dist/*-firefox.zip
166+ draft : false
167+ prerelease : false
168+
169+ - name : Create GitHub Release (no version bump)
170+ if : ${{ needs.changeset.outputs.hasChangesets == 'false' }}
171+ uses : softprops/action-gh-release@v1
172+ with :
173+ tag_name : v${{ needs.changeset.outputs.currentVersion }}-build-${{ github.run_number }}
174+ name : Build v${{ needs.changeset.outputs.currentVersion }}-build-${{ github.run_number }}
175+ body : |
176+ ## Build Release
177+
178+ This is a build release without version changes.
179+
180+ ## Extension Files
181+ - Chrome: `amgiflol-${{ needs.changeset.outputs.currentVersion }}-chrome.zip`
182+ - Firefox: `amgiflol-${{ needs.changeset.outputs.currentVersion }}-firefox.zip`
183+ files : |
184+ dist/*-chrome.zip
185+ dist/*-firefox.zip
186+ draft : false
187+ prerelease : true
0 commit comments