Skip to content

Commit 3e4eb81

Browse files
committed
Add GitHub Actions workflow for release process
1 parent af2bfa3 commit 3e4eb81

File tree

4 files changed

+99
-53
lines changed

4 files changed

+99
-53
lines changed

.github/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- ignore-for-release
5+
- ci
6+
- documentation
7+
- refactoring
8+
- test
9+
categories:
10+
- title: Features
11+
labels:
12+
- enhancement
13+
- title: Bug Fixes
14+
labels:
15+
- bug
16+
- title: Deprecated
17+
labels:
18+
- deprecate
19+
- title: Removed
20+
labels:
21+
- remove
22+
- title: Security
23+
labels:
24+
- security
25+
- title: Dependencies
26+
labels:
27+
- dependencies
28+
- title: Others
29+
labels:
30+
- "*"

.github/workflows/release.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
jobs:
7+
image-build:
8+
name: Push Container Image
9+
runs-on: ubuntu-24.04
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Get version
16+
id: get_version
17+
run: |
18+
version=${GITHUB_REF#refs/tags/v}
19+
echo "result=${version}" >> $GITHUB_OUTPUT
20+
- uses: docker/setup-qemu-action@v3
21+
with:
22+
platforms: linux/amd64
23+
- uses: docker/setup-buildx-action@v3
24+
- name: Login to GitHub Container Registry
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.repository_owner }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
- name: Build and push ofen image
31+
uses: docker/build-push-action@v6
32+
with:
33+
context: .
34+
file: dockerfiles/Dockerfile.imageprefetch-controller
35+
push: ${{ github.ref_name == 'main'}}
36+
tags: |
37+
ghcr.io/cybozu-go/ofen:${{steps.get_version.outputs.result}})
38+
- name: Build and push ofend image
39+
uses: docker/build-push-action@v6
40+
with:
41+
context: .
42+
file: dockerfiles/Dockerfile.nodeimageset-controller
43+
push: ${{ github.ref_name == 'main'}}
44+
tags: |
45+
ghcr.io/cybozu-go/ofend:${{steps.get_version.outputs.result}}
46+
release:
47+
name: Release on GitHub
48+
needs: image-build
49+
runs-on: ubuntu-24.04
50+
permissions:
51+
contents: write
52+
steps:
53+
- uses: actions/checkout@v4
54+
- name: Create Release
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
run: |
58+
VERSION=${GITHUB_REF#refs/tags/} # Don't remove "v" prefix.
59+
if echo ${VERSION} | grep -q -e '-'; then PRERELEASE_FLAG=-p; fi
60+
gh release create $VERSION $PRERELEASE_FLAG \
61+
-t "Release $VERSION" \
62+
--generate-notes

CHANGELOG.md

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

docs/release.md

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,15 @@ Release procedure
33

44
This document describes how to release a new version.
55

6-
## Versioning
7-
8-
Follow [semantic versioning 2.0.0][semver] to choose the new version number.
9-
10-
## Prepare change log entries
11-
12-
Add notable changes since the last release to [CHANGELOG.md](CHANGELOG.md).
13-
It should look like:
6+
## Labeling
147

15-
```markdown
16-
(snip)
17-
## [Unreleased]
8+
Release notes are automatically generated based on PRs included in the release.
9+
Those PRs are categorized based on the label assigned to them.
10+
Please refer to `.github/release.yml` for the kind of labels.
1811

19-
### Added
20-
- Implement ... (#35)
21-
22-
### Changed
23-
- Fix a bug in ... (#33)
24-
25-
### Removed
26-
- Deprecated `-option` is removed ... (#39)
12+
## Versioning
2713

28-
(snip)
29-
```
14+
Follow [semantic versioning 2.0.0][semver] to choose the new version number.
3015

3116
## Bump version
3217

@@ -38,25 +23,7 @@ It should look like:
3823
$ echo $VERSION
3924
```
4025

41-
2. Make a branch to release
42-
43-
```console
44-
$ git checkout main
45-
$ git pull
46-
$ git checkout -b "bump-$VERSION"
47-
```
48-
49-
3. Edit `CHANGELOG.md` for the new version ([example][]).
50-
4. Commit the change and push it.
51-
52-
```console
53-
$ git commit -a -m "Bump version to $VERSION"
54-
$ git push -u origin HEAD
55-
$ gh pr create -f
56-
```
57-
58-
5. Merge this branch.
59-
6. Add a git tag to the main HEAD, then push it.
26+
2. Add a git tag to the main HEAD, then push it.
6027

6128
```console
6229
# Set VERSION again.
@@ -77,4 +44,3 @@ GitHub actions will build and push artifacts such as container images and
7744
create a new GitHub release.
7845

7946
[semver]: https://semver.org/spec/v2.0.0.html
80-
[example]: https://github.com/cybozu-go/etcdpasswd/commit/77d95384ac6c97e7f48281eaf23cb94f68867f79

0 commit comments

Comments
 (0)