-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (75 loc) · 3.13 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: maven-release
concurrency: dev-build
on:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f
with:
disable-sudo: true
egress-policy: audit #outbound hosts constantly subject to change by action providers
- uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb
- name: Set up JDK 21
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b
with:
java-version: 21
distribution: 'temurin'
- name: Create Maven release
id: mvnrel
run: |
git config --global user.email "jens.dibbern@gmail.com"
git config --global user.name "datengaertnerei"
export OSM_IMPORT_FILE=https://github.com/datengaertnerei/test-data-service/raw/develop/data/osm-small.pbf
export MVNVER=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT//')
export PRSOURCE="PR-${MVNVER}"
export RELBRANCH="RB-${MVNVER}"
echo $RELTAG
git branch $RELBRANCH
git checkout $RELBRANCH
echo "Maven Release Prepare"
./mvnw clean release:prepare
echo "Maven Release Perform"
./mvnw release:perform
# omit maven release leftovers
git stash
# merge tag to main
git checkout "V${MVNVER}"
git switch -c $PRSOURCE
git push origin $PRSOURCE
# preserve branch and tag info
echo "release_branch=$RELBRANCH" >> $GITHUB_OUTPUT
echo "releasetag=V${MVNVER}" >> $GITHUB_OUTPUT
echo "prsource=$PRSOURCE" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: rel
uses: Roang-zero1/github-create-release-action@57eb9bdce7a964e48788b9e78b5ac766cb684803
with:
release_title: "Release ${{ steps.mvnrel.outputs.releasetag }}"
created_tag: ${{ steps.mvnrel.outputs.releasetag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create pull request - must run with a different GH token to allow merge check action trigger
- name: Create pull request to main
id: cpr_main
run: gh pr create --base $BASE --head $HEAD --title $TITLE --body $BODY --label release
env:
GITHUB_TOKEN: ${{ secrets.REL_SECRET }}
HEAD: ${{ steps.mvnrel.outputs.prsource }}
BASE: master
TITLE: "'Merge ${{ steps.mvnrel.outputs.prsource }} to main'"
BODY: "':crown: *An automated PR*'"
# Create pull request - must run with a different GH token to allow merge check action trigger
- name: Create pull request to dev
id: cpr_dev
run: gh pr create --base $BASE --head $HEAD --title $TITLE --body $BODY --label release
env:
GITHUB_TOKEN: ${{ secrets.REL_SECRET }}
HEAD: ${{ steps.mvnrel.outputs.release_branch }}
BASE: develop
TITLE: "'Merge ${{ steps.mvnrel.outputs.release_branch }} to dev'"
BODY: "':crown: *An automated PR*'"