Skip to content

Commit c958b14

Browse files
committed
Add release action, update README
1 parent be88fc2 commit c958b14

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags: [ "v*" ]
6+
7+
# run only one release action at a time for the repo, wait for the previous to finish before running another one
8+
concurrency:
9+
group: ${{ github.repository }}-${{ github.workflow }}
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v5
16+
with:
17+
# Fetch all history for all branches and tags - just in case it's all necessary for ci-release.
18+
# Tags are needed for versionPolicyCheck binary and source compat checks.
19+
fetch-depth: 0
20+
- uses: coursier/cache-action@v6
21+
- uses: actions/setup-java@v5
22+
with:
23+
java-version: 17
24+
distribution: temurin
25+
cache: sbt
26+
- uses: sbt/setup-sbt@v1
27+
# sbt ci-release doesn't verify the build, need to do it explicitly
28+
- name: sbt build
29+
run: sbt clean build
30+
- run: sbt ci-release
31+
env:
32+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
33+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
34+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
35+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
36+
37+
- name: delete release tag if failed
38+
if: failure()
39+
run: git push --delete origin ${{ github.ref_name }}
40+
41+
- name: publish release notes
42+
if: success()
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
tag: ${{ github.ref_name }}
46+
run: |
47+
gh release create "$tag" \
48+
--repo="$GITHUB_REPOSITORY" \
49+
--title="v${tag#v}" \
50+
--generate-notes

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The minimum supported JDK version is 17.
1010
## Table of Contents
1111

1212
- [Modules](#modules)
13-
- [k8s-dns-name-resolver](#k8s-dns-name-resolver)
13+
- [k8s-dns-name-resolver](#k8s-dns-name-resolver)
1414
- [For Contributors](#for-contributors)
1515

1616
## Modules
@@ -88,3 +88,27 @@ A full build can be run with:
8888
```shell
8989
sbt build
9090
```
91+
92+
### How to Make a Release
93+
94+
- Being on the up-to-date main branch, create a release tag:
95+
96+
```shell
97+
git tag v1.2.3
98+
```
99+
100+
- Push the tag:
101+
102+
```shell
103+
git push origin v1.2.3
104+
```
105+
106+
- This will trigger the release GitHub Action.
107+
If it succeeds, the release ends up on Maven Central with GitHub release notes generated
108+
automatically from PRs info.
109+
- If the release GitHub Action fails, the tag will be deleted on remote.
110+
After deleting the tag locally, fix the main branch and do the process again:
111+
112+
```shell
113+
git tag -d v1.2.3
114+
```

0 commit comments

Comments
 (0)