Skip to content

Commit 5924b11

Browse files
authored
Merge pull request #226 from vedansh-5/release
[MINOR] release workflows corrected also added publish workflows
2 parents bcb16c8 + c08fc87 commit 5924b11

File tree

4 files changed

+157
-27
lines changed

4 files changed

+157
-27
lines changed

.github/release-drafter.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,46 @@
1-
name-template: 'v$RESOLVED_VERSION 🌈'
1+
name-template: 'v$RESOLVED_VERSION'
22
tag-template: 'v$RESOLVED_VERSION'
33
categories:
4-
- title: '🚀 Features'
4+
- title: 'Features'
55
labels:
66
- 'feature'
77
- 'enhancement'
8-
- title: '🐛 Bug Fixes'
8+
- title: 'Bug Fixes'
99
labels:
1010
- 'fix'
1111
- 'bugfix'
1212
- 'bug'
13-
- title: '🧰 Maintenance'
14-
labels: 'chore'
15-
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
13+
- title: 'Maintenance'
14+
labels:
15+
- 'chore'
16+
- 'dependencies'
17+
- 'ci'
18+
- 'refactor'
19+
template: |
20+
## What's Changed
21+
22+
$CHANGES
23+
24+
change-template: '* $TITLE (#$NUMBER) @$AUTHOR'
1625
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
1726
version-resolver:
1827
major:
1928
labels:
20-
- 'major'
29+
- 'release:major'
30+
- 'major' # major in pr title
2131
minor:
2232
labels:
33+
- 'release:minor'
2334
- 'minor'
2435
patch:
2536
labels:
37+
- 'release:patch'
2638
- 'patch'
39+
- 'fix'
40+
- 'documentation'
41+
- 'chore'
2742
default: patch
28-
template: |
29-
## Changes
3043

31-
$CHANGES
44+
exclude-labels:
45+
- 'skip-changelog'
46+
- 'release:none'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish to Chrome Web Store
2+
3+
on:
4+
release:
5+
types: [published] # triggers when a release is published manually
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
with:
14+
ref: ${{ github.ref_name }}
15+
16+
- name: Create ZIP file
17+
run: |
18+
cd src
19+
zip -r ../scrum-helper.zip .
20+
21+
- name: Upload to Chrome Web Store
22+
uses: PlasmoHQ/chrome-extension@v3
23+
with:
24+
client_id: ${{ secrets.CHROME_CLIENT_ID }}
25+
client_secret: ${{ secrets.CHROME_CLIENT_SECRET }}
26+
refresh_token: ${{ secrets.CHROME_REFRESH_TOKEN }}
27+
extension_id: ${{ secrets.CHROME_EXTENSION_ID }}
28+
zip: scrum-helper.zip

.github/workflows/release-drafter.yml

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,70 @@ on:
66
branches:
77
- master
88

9-
# pull_request event is required only for autolabeler
109
pull_request:
11-
# Only following types are handled by the action, but one can default to all as well
1210
types: [opened, reopened, synchronize]
13-
# pull_request_target event is required for autolabeler to support PRs from forks
14-
# pull_request_target:
15-
# types: [opened, reopened, synchronize]
1611

1712
permissions:
18-
contents: read
13+
contents: write
1914

2015
jobs:
2116
update_release_draft:
2217
permissions:
2318
# write permission is required to create a github release
2419
contents: write
2520
# write permission is required for autolabeler
26-
# otherwise, read permission is required at least
2721
pull-requests: write
2822
runs-on: ubuntu-latest
2923
steps:
30-
# (Optional) GitHub Enterprise requires GHE_HOST variable set
31-
#- name: Set GHE_HOST
32-
# run: |
33-
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
3424

3525
# Drafts your next Release notes as Pull Requests are merged into "master"
36-
- uses: release-drafter/[email protected]
37-
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
38-
# with:
39-
# config-name: my-config.yml
40-
# disable-autolabeler: true
26+
- name: Draft Release
27+
id: release_drafter
28+
uses: release-drafter/release-drafter@v6
29+
with:
30+
config-name: release-drafter.yml
31+
publish: true
4132
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
34+
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
39+
40+
- name: Ensure correct branch is checked out (only on PR)
41+
if: github.event_name == 'pull_request'
42+
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'
51+
52+
- name: Update Changelog
53+
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
61+
if [ -f CHANGELOG.md ]; then
62+
cat CHANGELOG.md >> new_changelog_entry.md
63+
fi
64+
mv new_changelog_entry.md CHANGELOG.md
65+
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 }}
73+
74+
75+

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,64 @@ If you want to share your translation with others:
178178
For more details, see the [Chrome i18n documentation](https://developer.chrome.com/docs/extensions/reference/i18n/).
179179

180180

181+
## Release Process
182+
183+
This project uses a fully automated release process powered by GitHub Actions. Understanding this process is helpful for both maintainers and contributors.
184+
185+
The process is split into two parts:
186+
187+
### 1. Automated Release Drafting
188+
189+
This part runs every time a pull request is merged into the `master` branch.
190+
191+
1. **PR Merge**: A contributor's pull request is reviewed and merged.
192+
2. **Drafting Workflow**: The "Release Drafter" workflow is triggered.
193+
3. **Versioning**: The workflow inspects the `release:*` label or PR title to determine the next semantic version.
194+
4. **Changelog Update**: The `CHANGELOG.md` file is automatically updated with the titles of the merged PRs.
195+
5. **Draft Creation**: A new draft release is created or updated in the [Releases](https://github.com/fossasia/scrum-helper/releases) section. This draft includes the new version tag and the updated changelog notes.
196+
197+
### 2. Manual Release Publishing
198+
199+
This part is performed manually by maintainers when it's time to publish a new version.
200+
201+
1. **Verification**: A maintainer reviews the draft release to ensure it's accurate and complete.
202+
2. **Publishing**: The maintainer publishes the release from the GitHub UI.
203+
3. **Chrome Web Store Deployment**: Publishing the release triggers the "Publish to Chrome Web Store" workflow, which automatically packages the extension and uploads it for review.
204+
181205
## About contributing
182206

183207
- Follow the Issues and PRs templates as far as possible.
184208
- If you want to make a PR, please mention in the corresponding issue that you are working on it.
209+
210+
### Writing Meaningful Pull Requests
211+
212+
The release notes are automatically generated from the pull requests merged into `master`. To ensure the release notes are clear and helpful, please:
213+
214+
1. **Write a descriptive title.** The PR title is the primary entry in the release notes. It should concisely summarize the change.
215+
2. **Provide a clear description.** The body of your PR should explain the "what" and "why" of your changes. This context is invaluable for reviewers and for anyone looking back at the project's history.
216+
217+
### Pull Request Labeling & Semantic Versioning
218+
This project uses an automated release process that relies on pull request labels and titles to determine the semantic version for a new release. For your contribution to be included in the release notes, please use one of the methods below.
219+
220+
**Method 1: Using Labels (Preferred)**
221+
222+
The clearest way to signal the impact of your change is to apply **one** of the following labels to your pull request. This is the recommended approach.
223+
224+
- `release:major`: For breaking changes that are not backward-compatible.
225+
- `release:minor`: For new features or significant enhancements.
226+
- `release:patch`: For backward-compatible bug fixes, documentation updates, or maintenance.
227+
- `release:none`: To exclude the change from the release notes entirely.
228+
229+
**Method 2: Using PR Titles**
230+
231+
As a fallback, if no `release:*` label is applied, the system will inspect your pull request title for the following keywords (case-insensitive) to determine the version bump:
232+
233+
- `major`: For breaking changes.
234+
- `minor`: For new features.
235+
- `patch`, `fix`, `chore`, `documentation` : For bug fixes and other small changes.
236+
237+
If you are unsure which label to use, please write a clear and descriptive title, and a maintainer will apply the correct label before merging.
238+
185239
- Before making a PR, ensure your code is properly formatted and linted:
186240
- Format your code: This command automatically formats your code based on the project's style guidelines.
187241
```sh

0 commit comments

Comments
 (0)