Skip to content

Commit 32bee26

Browse files
GitHub Actionssm17p
authored andcommitted
chore(release): v0.2.1
1 parent ebdb668 commit 32bee26

5 files changed

Lines changed: 78 additions & 319 deletions

File tree

.changeset/every-parts-float.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 71 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ on:
2323
type: boolean
2424

2525
jobs:
26-
changeset-check:
26+
changeset_check:
2727
permissions:
2828
contents: write
29-
pull-requests: write
3029
name: Version with Changeset
3130
runs-on: ubuntu-24.04-arm
3231
if: |
@@ -71,7 +70,7 @@ jobs:
7170
fi
7271
7372
- name: Version packages
74-
if: steps.changeset-check.outputs.hasChangesets == 'true'
73+
if: steps.changeset_check.outputs.hasChangesets == 'true'
7574
id: version
7675
run: |
7776
pnpm changeset version
@@ -80,16 +79,15 @@ jobs:
8079
echo "📦 New version: $NEW_VERSION"
8180
8281
- name: Get current version (if no changesets)
83-
if: steps.changeset-check.outputs.hasChangesets == 'false'
82+
if: steps.changeset_check.outputs.hasChangesets == 'false'
8483
id: current-version
8584
run: |
8685
CURRENT_VERSION=$(node -p "require('./package.json').version")
8786
echo "currentVersion=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
8887
echo "📦 Current version: $CURRENT_VERSION"
8988
90-
# Only auto-commit on push to main
9189
- name: Commit and Push (with version bump)
92-
if: ${{ github.event_name == 'push' && steps.changeset-check.outputs.hasChangesets == 'true' }}
90+
if: ${{ steps.changeset-check.outputs.hasChangesets == 'true' }}
9391
run: |
9492
git add .
9593
git commit -m "chore(release): v$NEW_VERSION"
@@ -99,110 +97,70 @@ jobs:
9997
env:
10098
NEW_VERSION: ${{ steps.version.outputs.newVersion }}
10199

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-
# });
100+
release:
101+
name: Create Release
102+
runs-on: ubuntu-24.04-arm
103+
needs: [changeset_check]
104+
permissions:
105+
contents: write
106+
steps:
107+
- uses: actions/checkout@v4
108+
with:
109+
fetch-depth: 0
110+
111+
- uses: pnpm/action-setup@v4
112+
name: Install pnpm
113+
with:
114+
run_install: false
115+
116+
- uses: actions/setup-node@v4
117+
with:
118+
node-version: 24
119+
cache: "pnpm"
120+
121+
- name: Install dependencies
122+
run: pnpm install --frozen-lockfile
123+
124+
- name: Build and Zip
125+
run: |
126+
pnpm run zip:all
127+
128+
- name: Create GitHub Release (with version bump)
129+
if: ${{ steps.changeset.outputs.hasChangesets == 'true' }}
130+
uses: softprops/action-gh-release@v1
131+
with:
132+
tag_name: v${{ needs.changeset_check.outputs.newVersion }}
133+
name: Release v${{ needs.changeset_check.outputs.newVersion }}
134+
body: |
135+
## Changes
136+
137+
Check the [CHANGELOG.md](./CHANGELOG.md) for detailed changes.
138+
139+
## Extension Files
140+
- Chrome: `amgiflol-${{ needs.changeset_check.outputs.newVersion }}-chrome.zip`
141+
- Firefox: `amgiflol-${{ needs.changeset_check.outputs.newVersion }}-firefox.zip`
142+
- Firefox Sources: `amgiflol-${{ needs.changeset_check.outputs.currentVersion }}-sources.zip`
143+
files: |
144+
dist/*.zip
145+
draft: false
146+
prerelease: false
147+
148+
- name: Create GitHub Release (no version bump)
149+
if: ${{ needs.changeset_check.outputs.hasChangesets == 'false' }}
150+
uses: softprops/action-gh-release@v1
151+
with:
152+
tag_name: v${{ needs.changeset_check.outputs.currentVersion }}-build-${{ github.run_number }}
153+
name: Build v${{ needs.changeset_check.outputs.currentVersion }}-build-${{ github.run_number }}
154+
body: |
155+
## Build Release
156+
157+
This is a build release without version changes.
158+
159+
## Extension Files
160+
- Chrome: `amgiflol-${{ needs.changeset_check.outputs.currentVersion }}-chrome.zip`
161+
- Firefox: `amgiflol-${{ needs.changeset_check.outputs.currentVersion }}-firefox.zip`
162+
- Firefox Sources: `amgiflol-${{ needs.changeset_check.outputs.currentVersion }}-sources.zip`
163+
files: |
164+
dist/*.zip
165+
draft: false
166+
prerelease: true

0 commit comments

Comments
 (0)