Skip to content

Commit 382652d

Browse files
authored
Borrow the release process from pseudo-service (#525)
* Borrow the release process from pseudo-service * Split klass-forvaltning tests into their own workflow
1 parent 86ef62c commit 382652d

File tree

11 files changed

+342
-79
lines changed

11 files changed

+342
-79
lines changed

.github/labels.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
# Labels names are important as they are used by Release Drafter to decide
3+
# regarding where to record them in changelog or if to skip them.
4+
#
5+
# The repository labels will be automatically configured using this file and
6+
# the GitHub Action https://github.com/marketplace/actions/github-labeler.
7+
- name: breaking
8+
description: Breaking Changes
9+
color: bfd4f2
10+
- name: bug
11+
description: Something isn't working
12+
color: d73a4a
13+
- name: build
14+
description: Build System and Dependencies
15+
color: bfdadc
16+
- name: ci
17+
description: Continuous Integration
18+
color: 4a97d6
19+
- name: dependencies
20+
description: Pull requests that update a dependency file
21+
color: 0366d6
22+
- name: documentation
23+
description: Improvements or additions to documentation
24+
color: 0075ca
25+
- name: duplicate
26+
description: This issue or pull request already exists
27+
color: cfd3d7
28+
- name: enhancement
29+
description: New feature or request
30+
color: a2eeef
31+
- name: github_actions
32+
description: Pull requests that update Github_actions code
33+
color: "000000"
34+
- name: good first issue
35+
description: Good for newcomers
36+
color: 7057ff
37+
- name: help wanted
38+
description: Extra attention is needed
39+
color: "008672"
40+
- name: invalid
41+
description: This doesn't seem right
42+
color: e4e669
43+
- name: performance
44+
description: Performance
45+
color: "016175"
46+
- name: question
47+
description: Further information is requested
48+
color: d876e3
49+
- name: refactoring
50+
description: Refactoring
51+
color: ef67c4
52+
- name: removal
53+
description: Removals and Deprecations
54+
color: 9ae7ea
55+
- name: style
56+
description: Style
57+
color: c120e5
58+
- name: testing
59+
description: Testing
60+
color: b1fc6f
61+
- name: wontfix
62+
description: This will not be worked on
63+
color: ffffff

.github/release-drafter.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
categories:
2+
- title: ":boom: Breaking Changes"
3+
label: "breaking"
4+
- title: ":rocket: Features"
5+
label: "enhancement"
6+
- title: ":fire: Removals and Deprecations"
7+
label: "removal"
8+
- title: ":beetle: Fixes"
9+
label: "bug"
10+
- title: ":racehorse: Performance"
11+
label: "performance"
12+
- title: ":rotating_light: Testing"
13+
label: "testing"
14+
- title: ":construction_worker: Continuous Integration"
15+
label: "ci"
16+
- title: ":books: Documentation"
17+
label: "documentation"
18+
- title: ":hammer: Refactoring"
19+
label: "refactoring"
20+
- title: ":lipstick: Style"
21+
label: "style"
22+
- title: ":package: Dependencies"
23+
labels:
24+
- "dependencies"
25+
- "build"
26+
27+
autolabeler:
28+
- label: 'documentation'
29+
branch:
30+
- '/docs{0,1}\/.+/'
31+
- label: 'bug'
32+
branch:
33+
- '/fix\/.+/'
34+
title:
35+
- '/fix/i'
36+
- label: 'enhancement'
37+
branch:
38+
- '/feat\/.+/'
39+
body:
40+
- '/JIRA-[0-9]{1,4}/'
41+
- label: 'refactoring'
42+
branch:
43+
- '/refactor\/.+/'
44+
title:
45+
- '/^refactor/i'
46+
- label: 'testing'
47+
branch:
48+
- '/test\/.+/'
49+
- label: 'breaking'
50+
title:
51+
- '/breaking change/i'
52+
- label: 'ci'
53+
files:
54+
- '.github/*'
55+
56+
template: |
57+
## Changes
58+
59+
$CHANGES

.github/workflows/labeler.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Labeler
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
labeler:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out the repository
13+
uses: actions/checkout@v4
14+
15+
# Reads labels from .github/labels.yml
16+
- name: Run Labeler
17+
uses: crazy-max/ghaction-github-labeler@v5
18+
with:
19+
skip-delete: true

.github/workflows/mvn-release.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- release
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
# Do not run workflow if the triggering commit created the 'release' branch
12+
if: ${{github.event.created}} == false
13+
permissions:
14+
contents: write
15+
id-token: write
16+
packages: write
17+
18+
steps:
19+
- name: Create DaplaBot app token
20+
uses: actions/create-github-app-token@v1
21+
id: app-token
22+
with:
23+
app-id: ${{ secrets.DAPLA_BOT_APP_ID }}
24+
private-key: ${{ secrets.DAPLA_BOT_PRIVATE_KEY }}
25+
26+
- uses: actions/checkout@v4
27+
with:
28+
token: ${{ steps.app-token.outputs.token }}
29+
ref: refs/heads/master
30+
31+
- name: Set up JDK
32+
uses: actions/setup-java@v4
33+
with:
34+
java-version: 17
35+
distribution: temurin
36+
cache: maven
37+
overwrite-settings: false
38+
39+
- name: Get bot variables
40+
id: get-bot-vars
41+
run: |
42+
bot_name="dapla-bot"
43+
bot_id=$(curl -s https://api.github.com/users/${bot_name}%5Bbot%5D | jq '.id')
44+
bot_email="${dapla_bot_id}+${bot_name}[bot]@users.noreply.github.com"
45+
46+
echo "bot_name=${bot_name}[bot]" >> $GITHUB_OUTPUT
47+
echo "bot_email=${bot_email}" >> $GITHUB_OUTPUT
48+
49+
- name: Configure Git user
50+
run: |
51+
git config user.email ${{steps.get-bot-vars.outputs.bot_email}}
52+
git config user.name ${{steps.get-bot-vars.outputs.bot_name}}
53+
54+
- name: Setup Maven authentication to GitHub packages
55+
uses: s4u/maven-settings-action@v3.0.0
56+
with:
57+
override: true
58+
githubServer: false
59+
servers: >-
60+
[{"id": "github","username": "${{steps.get-bot-vars.outputs.bot_email}}","password": "${{steps.app-token.outputs.token}}",
61+
"configuration": {"httpHeaders": {"property": {"name": "Authorization","value": "Bearer ${{ secrets.GITHUB_TOKEN }}"}}}}]
62+
63+
- name: Maven release and deploy to GitHub packages
64+
id: release-artifact
65+
run: |
66+
# Get the release version from the pom.xml before the next snapshot increment
67+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed "s/-SNAPSHOT//")
68+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
69+
# Perform the release/deploy and increment the version to the next snapshot
70+
mvn --batch-mode release:prepare -P github -Darguments="-Dmaven.test.skip=true -Dmaven.deploy.skip=true"
71+
mvn --batch-mode release:perform
72+
TAG=$(git describe --abbrev=0 --tags)
73+
echo "tag=${TAG}" >> $GITHUB_OUTPUT
74+
75+
- name: Create GitHub release draft
76+
uses: release-drafter/release-drafter@v6
77+
id: create-github-release
78+
env:
79+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
80+
with:
81+
tag: ${{ steps.release-artifact.outputs.tag }}
82+
83+
- name: Upload assets to GitHub release draft
84+
env:
85+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
86+
run: |
87+
ARTIFACT_ID=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)
88+
# Get all files matching the artifact id and version (source, javadoc, etc.)
89+
ARTIFACT_GLOB=(./target/$ARTIFACT_ID-${{ steps.release-artifact.outputs.version }}*.jar)
90+
for file in "${ARTIFACT_GLOB[@]}"; do
91+
echo "Uploading $file"
92+
gh release upload ${{ steps.create-github-release.outputs.tag_name }} $file
93+
done
94+
95+
- name: Publish GitHub release
96+
uses: eregon/publish-release@v1
97+
env:
98+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
99+
with:
100+
release_id: ${{ steps.create-github-release.outputs.id }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
# pull_request event is required only for autolabeler
8+
pull_request:
9+
types:
10+
- opened
11+
- reopened
12+
- synchronize
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
update_release_draft:
19+
permissions:
20+
# write permission is required to create a GitHub release
21+
contents: write
22+
# write permission is required for autolabeler
23+
# otherwise, read permission is required at least
24+
pull-requests: write
25+
runs-on: ubuntu-latest
26+
steps:
27+
# Draft the next Release notes as Pull Requests are merged into main
28+
29+
- uses: release-drafter/release-drafter@v5
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Tests Klass Forvaltning
2+
run-name: "Build, run tests, package and deploy"
3+
permissions:
4+
contents: read
5+
packages: read
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- klass-forvaltning
13+
- .github/workflows/tests-klass-forvaltning.yml
14+
pull_request:
15+
paths:
16+
- klass-forvaltning
17+
- .github/workflows/tests-klass-forvaltning.yml
18+
19+
jobs:
20+
build-klass-forvaltning:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
packages: read
25+
steps:
26+
- uses: actions/checkout@v6
27+
- name: Set up JDK 1.8
28+
uses: actions/setup-java@v4
29+
with:
30+
distribution: 'zulu'
31+
java-version: '8'
32+
cache: maven
33+
34+
# Build only klass-forvaltning with JDK 1.8
35+
- name: Build and test Klass Forvaltning
36+
working-directory: klass-forvaltning
37+
run: mvn --batch-mode --update-snapshots package -Djava.version=1.8 -am
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)