Skip to content

Commit e43f0de

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

5 files changed

Lines changed: 60 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: 53 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: |
@@ -87,122 +86,63 @@ jobs:
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"
96-
git tag v$NEW_VERSION
9794
git push
98-
git push --tags
9995
env:
10096
NEW_VERSION: ${{ steps.version.outputs.newVersion }}
10197

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-
# });
98+
release:
99+
name: Create Release
100+
runs-on: ubuntu-24.04-arm
101+
needs: [changeset_check]
102+
permissions:
103+
contents: write
104+
steps:
105+
- uses: actions/checkout@v4
106+
with:
107+
fetch-depth: 0
108+
109+
- uses: pnpm/action-setup@v4
110+
name: Install pnpm
111+
with:
112+
run_install: false
113+
114+
- uses: actions/setup-node@v4
115+
with:
116+
node-version: 24
117+
cache: "pnpm"
118+
119+
- name: Install dependencies
120+
run: pnpm install --frozen-lockfile
121+
122+
- name: Build and Zip
123+
run: |
124+
pnpm run zip:all
125+
126+
- name: Create GitHub Release (with version bump)
127+
if: ${{ needs.changeset_check.outputs.hasChangesets == 'true' }}
128+
uses: softprops/action-gh-release@v1
129+
with:
130+
tag_name: v${{ needs.changeset_check.outputs.currentVersion }}
131+
name: amgiflol@${{ needs.changeset_check.outputs.currentVersion }}
132+
body_path: CHANGELOG.md
133+
files: |
134+
dist/*.zip
135+
draft: false
136+
prerelease: false
137+
138+
- name: Create GitHub Release (no version bump)
139+
if: ${{ needs.changeset_check.outputs.hasChangesets == 'false' }}
140+
uses: softprops/action-gh-release@v1
141+
with:
142+
tag_name: v${{ needs.changeset_check.outputs.currentVersion }}
143+
name: amgiflol@${{ needs.changeset_check.outputs.currentVersion }}
144+
body_path: CHANGELOG.md
145+
files: |
146+
dist/*.zip
147+
draft: true
148+
prerelease: true

.github/workflows/submit.yml

Lines changed: 0 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)