Skip to content

Commit 2813c7a

Browse files
authored
Merge pull request #237 from vedansh-5/master
[PATCH] Release and Chrome webstore workflow changes.
2 parents 1a177e4 + bf8bf88 commit 2813c7a

File tree

3 files changed

+96
-43
lines changed

3 files changed

+96
-43
lines changed

.github/workflows/publish-to-chrome.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,32 @@ jobs:
1111
- name: Checkout code
1212
uses: actions/checkout@v4
1313
with:
14-
ref: ${{ github.ref_name }}
14+
ref: ${{ github.event.release.tag_name }}
15+
fetch-depth: 0
1516

1617
- name: Create ZIP file
1718
run: |
19+
if [ ! -d src ]; then
20+
echo "src directory not found"
21+
exit 1
22+
fi
1823
cd src
19-
zip -r ../scrum-helper.zip .
24+
zip -r ../scrum-helper.zip . >/dev/null
25+
echo "Created zip:"
26+
unzip -l ../scrum-helper.zip
27+
if unzip -l ../scrum-helper.zip | awk '{print $4}' | grep -q '^manifest.json$'; then
28+
echo "manifest.json is at zip root"
29+
else
30+
echo "ERROR: manifest.json NOT at zip root; zip will fail on Chrome Web Store"
31+
exit 1
32+
fi
2033
21-
- name: Upload to Chrome Web Store
34+
- name: Upload and Publish to Chrome Web Store
2235
uses: PlasmoHQ/chrome-extension@v3
2336
with:
2437
client_id: ${{ secrets.CHROME_CLIENT_ID }}
2538
client_secret: ${{ secrets.CHROME_CLIENT_SECRET }}
2639
refresh_token: ${{ secrets.CHROME_REFRESH_TOKEN }}
2740
extension_id: ${{ secrets.CHROME_EXTENSION_ID }}
28-
zip: scrum-helper.zip
41+
zip: scrum-helper.zip
42+
publish: true

.github/workflows/release-drafter.yml

Lines changed: 62 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ name: Release Drafter
22

33
on:
44
push:
5-
# branches to consider in the event; optional, defaults to all
65
branches:
76
- master
8-
97
pull_request:
108
types: [opened, reopened, synchronize]
119

@@ -15,61 +13,86 @@ permissions:
1513
jobs:
1614
update_release_draft:
1715
permissions:
18-
# write permission is required to create a github release
1916
contents: write
20-
# write permission is required for autolabeler
2117
pull-requests: write
2218
runs-on: ubuntu-latest
2319
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
2424

25-
# Drafts your next Release notes as Pull Requests are merged into "master"
2625
- name: Draft Release
2726
id: release_drafter
2827
uses: release-drafter/release-drafter@v6
2928
with:
3029
config-name: release-drafter.yml
3130
publish: false
3231
env:
33-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
34-
35-
- name: Checkout code
36-
uses: actions/checkout@v4
37-
with:
38-
fetch-depth: 0
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3933

40-
- name: Ensure correct branch is checked out (only on PR)
41-
if: github.event_name == 'pull_request'
34+
- name: Debug release-drafter outputs (safe)
4235
run: |
43-
echo "Checking out PR source branch: ${{ github.head_ref }}"
44-
git fetch origin ${{ github.head_ref }}
45-
git checkout ${{ github.head_ref }}
46-
47-
- name: Setup Node.js
48-
uses: actions/setup-node@v4
49-
with:
50-
node-version: '20'
36+
printf 'release-drafter.tag_name=%s\n' "${{ steps.release_drafter.outputs.tag_name }}"
37+
echo 'release-drafter.body:'
38+
printf '%s\n' "${{ steps.release_drafter.outputs.body }}" > /tmp/release_drafter_body.txt
39+
echo "Wrote release body to /tmp/release_drafter_body.txt"
5140
52-
- name: Update Changelog
41+
- name: Create / prepend CHANGELOG entry
42+
if: steps.release_drafter.outputs.tag_name != ''
5343
run: |
54-
VERSION="${{ steps.release_drafter.outputs.tag_name }}"
55-
BODY="${{ steps.release_drafter.outputs.body }}"
56-
57-
# Create a new changelog entry file
58-
echo -e "## ${VERSION} ($(date +'%Y-%m-%d'))\n\n${BODY}\n\n" > new_changelog_entry.md
59-
60-
# Prepend the new entry to the existing CHANGELOG.md
44+
TAG="${{ steps.release_drafter.outputs.tag_name }}"
45+
BODY_FILE="/tmp/release_drafter_body.txt"
46+
DATE="$(date +%F)"
47+
if [ -f "$BODY_FILE" ]; then
48+
BODY="$(cat "$BODY_FILE")"
49+
else
50+
BODY="${{ steps.release_drafter.outputs.body }}"
51+
fi
52+
printf "## %s - %s\n\n%s\n\n---\n\n" "$TAG" "$DATE" "$BODY" > /tmp/new_changelog.md
6153
if [ -f CHANGELOG.md ]; then
62-
cat CHANGELOG.md >> new_changelog_entry.md
54+
cat CHANGELOG.md >> /tmp/new_changelog.md
6355
fi
64-
mv new_changelog_entry.md CHANGELOG.md
56+
mv /tmp/new_changelog.md CHANGELOG.md
57+
git status --porcelain || true
6558
66-
# Commits the updated CHANGELOG.md and creates a tag for the new version
67-
- name: Commit and Push Changelog
68-
uses: stefanzweifel/git-auto-commit-action@v5
69-
with:
70-
commit_message: 'docs: Update CHANGELOG.md for ${{ steps.release_drafter.outputs.tag_name }}'
71-
file_pattern: 'CHANGELOG.md'
72-
tagging_message: ${{ steps.release_drafter.outputs.tag_name }}
59+
- name: Commit & push CHANGELOG and tag via GITHUB_TOKEN
60+
if: steps.release_drafter.outputs.tag_name != ''
61+
env:
62+
TAG: ${{ steps.release_drafter.outputs.tag_name }}
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
run: |
65+
set -e
66+
git config user.name "github-actions[bot]"
67+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
68+
69+
git add CHANGELOG.md || true
70+
71+
if git diff --cached --quiet; then
72+
echo "No CHANGELOG.md changes to commit"
73+
else
74+
git commit -m "docs(changelog): update for ${TAG}"
75+
fi
76+
77+
REPO="${{ github.repository }}"
78+
79+
# Push commit (use token to authenticate)
80+
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${REPO}.git" HEAD:refs/heads/master
7381
82+
# Create annotated tag if missing and push it
83+
if git rev-parse "${TAG}" >/dev/null 2>&1; then
84+
echo "Tag ${TAG} already exists locally"
85+
else
86+
git tag -a "${TAG}" -m "Release ${TAG}" || true
87+
fi
88+
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${REPO}.git" "refs/tags/${TAG}" || echo "Tag push failed or tag exists"
7489
75-
90+
- name: Setup Node.js
91+
uses: actions/setup-node@v4
92+
with:
93+
node-version: '20'
94+
95+
- name: (Optional) Update Changelog formatting / run scripts
96+
run: |
97+
# placeholder for any project-specific changelog formatting commands
98+
echo "Changelog updated; no additional formatting configured"

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
## v0.1.2 - 2025-09-08
2+
3+
## What's Changed
4+
5+
* No changes
6+
7+
---
8+
9+
## v0.1.2 (2025-09-08)
10+
11+
## What's Changed
12+
13+
* No changes
14+
15+
16+
117
## v1.0.4 (2025-08-29)
218

319
## What's Changed

0 commit comments

Comments
 (0)