Skip to content

Commit 4db3656

Browse files
authored
Merge pull request #55 from github/jm-automated-releases-and-autolabelling
feat: automated releases and auto labelling
2 parents 4c885fb + 4668b97 commit 4db3656

7 files changed

+201
-60
lines changed

.github/pull_request_template.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Pull Request
2-
<!-- PR title should be brief and descriptive for a good changelog entry -->
2+
<!--
3+
PR title needs to be prefixed with a conventional commit type
4+
(build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test)
5+
6+
It should also be brief and descriptive for a good changelog entry
7+
8+
examples: "feat: add new logger" or "fix: remove unused imports"
9+
-->
310

411
## Proposed Changes
512
<!-- Describe what the changes are and link to a GitHub Issue if one exists -->

.github/release-drafter.yml

+36-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
---
12
name-template: 'v$RESOLVED_VERSION'
23
tag-template: 'v$RESOLVED_VERSION'
34
template: |
45
# Changelog
56
$CHANGES
6-
7-
See details of [all code changes](https://github.com/github/automatic-contrib-prs/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release
8-
7+
8+
See details of [all code changes](https://github.com/github/automatic-contrib-prs/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release
9+
910
categories:
1011
- title: '🚀 Features'
1112
labels:
@@ -22,19 +23,46 @@ categories:
2223
- 'automation'
2324
- 'documentation'
2425
- 'dependencies'
26+
- 'maintenance'
27+
- 'revert'
2528
- title: '🏎 Performance'
2629
label: 'performance'
2730
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
2831
version-resolver:
2932
major:
3033
labels:
31-
- 'type: breaking'
34+
- 'breaking'
3235
minor:
3336
labels:
34-
- 'type: enhancement'
37+
- 'enhancement'
3538
patch:
3639
labels:
37-
- 'type: bug'
38-
- 'type: maintenance'
39-
- 'type: documentation'
40+
- 'fix'
41+
- 'documentation'
42+
- 'maintenance'
4043
default: patch
44+
autolabeler:
45+
- label: 'automation'
46+
title:
47+
- '/^(build|ci|perf|refactor|test).*/i'
48+
- label: 'enhancement'
49+
title:
50+
- '/^(style).*/i'
51+
- label: 'documentation'
52+
title:
53+
- '/^(docs).*/i'
54+
- label: 'feature'
55+
title:
56+
- '/^(feat).*/i'
57+
- label: 'fix'
58+
title:
59+
- '/^(fix).*/i'
60+
- label: 'infrastructure'
61+
title:
62+
- '/^(infrastructure).*/i'
63+
- label: 'maintenance'
64+
title:
65+
- '/^(chore|maintenance).*/i'
66+
- label: 'revert'
67+
title:
68+
- '/^(revert).*/i'

.github/workflows/auto-labeler.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Auto Labeler
3+
4+
on:
5+
# pull_request event is required only for autolabeler
6+
pull_request:
7+
# Only following types are handled by the action, but one can default to all as well
8+
types: [opened, reopened, synchronize]
9+
# pull_request_target event is required for autolabeler to support PRs from forks
10+
pull_request_target:
11+
types: [opened, reopened, synchronize]
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
main:
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
name: Auto label pull requests
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: release-drafter/release-drafter@v6
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
with:
28+
config-name: release-drafter.yml

.github/workflows/pr-title.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Reference: https://github.com/amannn/action-semantic-pull-request
2+
---
3+
name: "Lint PR Title"
4+
5+
on:
6+
pull_request_target:
7+
types:
8+
- opened
9+
- edited
10+
- synchronize
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
main:
17+
permissions:
18+
pull-requests: read
19+
statuses: write
20+
name: Validate PR title
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: amannn/action-semantic-pull-request@v5
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
# Configure which types are allowed (newline-delimited).
28+
# From: https://github.com/commitizen/conventional-commit-types/blob/master/index.json
29+
# listing all below
30+
types: |
31+
build
32+
chore
33+
ci
34+
docs
35+
feat
36+
fix
37+
perf
38+
refactor
39+
revert
40+
style
41+
test

.github/workflows/release-drafter.yml

-21
This file was deleted.

.github/workflows/release.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
name: Release
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
create_release:
15+
outputs:
16+
full-tag: ${{ steps.release-drafter.outputs.tag_name }}
17+
short-tag: ${{ steps.get_tag_name.outputs.SHORT_TAG }}
18+
body: ${{ steps.release-drafter.outputs.body }}
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
pull-requests: read
23+
steps:
24+
- uses: release-drafter/release-drafter@v6
25+
id: release-drafter
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
with:
29+
config-name: release-drafter.yml
30+
publish: true
31+
- name: Get the short tag
32+
id: get_tag_name
33+
run: |
34+
short_tag=$(echo ${{ steps.release-drafter.outputs.tag_name }} | cut -d. -f1)
35+
echo "SHORT_TAG=$short_tag" >> $GITHUB_OUTPUT
36+
create_action_images:
37+
needs: create_release
38+
runs-on: ubuntu-latest
39+
permissions:
40+
packages: write
41+
env:
42+
REGISTRY: ghcr.io
43+
IMAGE_NAME: ${{ github.repository }}
44+
steps:
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
- name: Log in to the Container registry
48+
uses: docker/login-action@v3
49+
with:
50+
registry: ${{ env.REGISTRY }}
51+
username: ${{ github.actor }}
52+
password: ${{ secrets.GITHUB_TOKEN }}
53+
- uses: actions/checkout@v4
54+
- name: Push Docker Image
55+
if: ${{ success() }}
56+
uses: docker/build-push-action@v5
57+
with:
58+
context: .
59+
file: ./Dockerfile
60+
push: true
61+
tags: |
62+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
63+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create_release.outputs.full-tag }}
64+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create_release.outputs.short-tag }}
65+
platforms: linux/amd64
66+
provenance: false
67+
sbom: false
68+
create_discussion:
69+
needs: create_release
70+
runs-on: ubuntu-latest
71+
permissions:
72+
discussions: write
73+
steps:
74+
- name: Create an announcement discussion for release
75+
uses: abirismyname/[email protected]
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
with:
79+
title: ${{ needs.create_release.outputs.full-tag }}
80+
body: ${{ needs.create_release.outputs.body }}
81+
repository-id: ${{ secrets.RELEASE_DISCUSSION_REPOSITORY_ID }}
82+
category-id: ${{ secrets.RELEASE_DISCUSSION_CATEGORY_ID }}

CONTRIBUTING.md

+6-30
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,7 @@ A good bug report shouldn't leave others needing to chase you up for more inform
5353
<!-- omit in toc -->
5454
### How Do I Submit a Good Bug Report?
5555

56-
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
57-
58-
- Open an [Issue](https://github.com/github/automatic-contrib-prs/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
59-
- Explain the behavior you would expect and the actual behavior.
60-
- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
61-
- Provide the information you collected in the previous section.
62-
63-
Once it's filed:
64-
65-
- The project team will label the issue accordingly.
66-
- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.
67-
- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be implemented by someone.
56+
Please submit a bug report using our [GitHub Issues template](https://github.com/github/automatic-contrib-prs/issues/new?template=bug_report.yml).
6857

6958
## Suggesting Enhancements
7059

@@ -81,25 +70,12 @@ This section guides you through submitting an enhancement suggestion for automat
8170
<!-- omit in toc -->
8271
### How Do I Submit a Good Enhancement Suggestion?
8372

84-
Enhancement suggestions are tracked as [GitHub issues](https://github.com/github/automatic-contrib-prs/issues).
73+
Please submit an enhancement suggestion using our [GitHub Issues template](https://github.com/github/automatic-contrib-prs/issues/new?template=feature_request.yml).
74+
75+
### Pull Request Standards
8576

86-
- Use a **clear and descriptive title** for the issue to identify the suggestion.
87-
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
88-
- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
89-
- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to.
90-
- **Explain why this enhancement would be useful** to most automatic-contrib-prs users.
77+
We are using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) to standardize our pull request titles. This allows us to automatically generate labels and changelogs and follow semantic versioning. Please follow the commit message format when creating a pull request. What pull request title prefixes are expected are in the [pull_request_template.md](.github/pull_request_template.md) that is shown when creating a pull request.
9178

9279
## Releases
9380

94-
To release a new version, maintainers are to release new versions following semantic versioning and via GitHub Releases.
95-
Once the code is ready to release please do the following
96-
97-
1. Create a [GitHub release](https://github.com/github/automatic-contrib-prs/releases) based off the current draft and review release notes
98-
2. Ensure that the versioning is correct given the content of the release
99-
3. Check the box to release it to the GitHub Marketplace
100-
4. Publish the release
101-
5. Clone the repository at the release tag locally or in a codespace
102-
6. Authenticate to ghcr.io using [these instructions](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry)
103-
7. `docker build -t ghcr.io/github/automatic-contrib-prs:v1 .` where v1 is the current major version number
104-
8. `docker push ghcr.io/github/automatic-contrib-prs:v1` where v1 is the current major version number
105-
9. Update the `README.md` instructions to point to the new docker container
81+
Releases are automated but if you need to manually initiate a release you can do so through the GitHub Actions UI. If you have permissions to do so, you can navigate to the [Actions tab](https://github.com/github/automatic-contrib-prs/actions/workflows/release.yml) and select the `Run workflow` button. This will allow you to select the branch to release from and the version to release.

0 commit comments

Comments
 (0)