-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (84 loc) · 3.45 KB
/
create-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
87
88
89
90
91
92
93
94
95
96
97
98
name: Create Release
on:
workflow_dispatch:
inputs:
versionTag:
description: 'Version Tag (semantic version)'
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
settings-path: ${{ github.workspace }}
- name: Load local Maven repository cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up git
run: |
git config --global user.email "[email protected]"
git config --global user.name "JohnnyQ5"
- name: Set version in Maven project
run: mvn versions:set -DnewVersion=${{ github.event.inputs.versionTag }}
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Create Release Notes
if: ${{ !startsWith(github.ref, 'refs/tags/')
&& !( contains(github.event.inputs.versionTag, 'alpha')
|| contains(github.event.inputs.versionTag, 'beta')
|| contains(github.event.inputs.versionTag, 'rc')) }}
uses: actions/github-script@v6
with:
github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}}
script: |
await github.request(`POST /repos/${{ github.repository }}/releases`, {
tag_name: "${{ github.event.inputs.versionTag }}",
generate_release_notes: true
});
- name: Create Pre-Release Notes
if: ${{ !startsWith(github.ref, 'refs/tags/')
&& ( contains(github.event.inputs.versionTag, 'alpha')
|| contains(github.event.inputs.versionTag, 'beta')
|| contains(github.event.inputs.versionTag, 'rc')) }}
uses: actions/github-script@v6
with:
github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}}
script: |
await github.request(`POST /repos/${{ github.repository }}/releases`, {
tag_name: "${{ github.event.inputs.versionTag }}",
generate_release_notes: true,
prerelease: true
});
- name: Publish artefact to QBiC Nexus Repository
run: mvn --quiet --settings $GITHUB_WORKSPACE/.github.settings.xml deploy
env:
MAVEN_REPO_USERNAME: ${{ secrets.NEXUS_USERNAME }}
MAVEN_REPO_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
- name: Switch to new branch
run: git checkout -b release/set-version-to-${{ github.event.inputs.versionTag }}
- name: Set remote branch
run: git push --set-upstream origin release/set-version-to-${{ github.event.inputs.versionTag }}
- name: Checkin commit
run: git commit . -m 'Set version to ${{ github.event.inputs.versionTag }}'
- name: Push to Github
run: git push
- name: Open PR with version bump
uses: actions/github-script@v6
with:
github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}}
script: |
await github.request(`POST /repos/${{ github.repository }}/pulls`, {
title: 'Update version to ${{ github.event.inputs.versionTag }}',
head: 'release/set-version-to-${{ github.event.inputs.versionTag }}',
base: 'main'
});