-
Notifications
You must be signed in to change notification settings - Fork 8
122 lines (109 loc) · 3.75 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Release artifact will be pushed to Sonatype, which is synced to Maven Central
# Build artifacts get pushed to Sonatype and non-SNAPSHOT versions are then
# auto-synced to Maven Central.
#
# If images are given (separated by spaces), then they are assumed to be produced by
# Maven and have release and dev tags.
#
# Various secrets are needed to do the release.
#
# Credentials for Sonatype, needs a Sonatype account.
# - OSSRH_USERNAME
# - OSSRH_PASSWORD
# Will need GPG key + passphrase to sign artifacts for Maven Central
# - MAVEN_GPG_PASSPHRASE
# - MAVEN_GPG_KEY
name: "Publish: manual full release"
run-name: Release (${{ inputs.releaseversion }} -> ${{ inputs.nextversion}})
on:
workflow_dispatch:
inputs:
releaseversion:
description: 'Release version'
required: true
nextversion:
description: 'Next dev version'
required: true
workflow_call:
inputs:
releaseversion:
description: 'Release version'
required: true
type: string
nextversion:
description: 'Next dev version'
required: true
type: string
images:
description: 'Images to push'
required: false
type: string
jobs:
release:
runs-on: ubuntu-latest
env:
RELEASE: ${{ inputs.releaseversion }}
NEXT: ${{ inputs.nextversion }}
IMAGES: ${{ inputs.images }}
steps:
- name: Checkout latest code
uses: actions/checkout@v3
- name: Setup Java & Maven
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Config git user
run: |
git config user.name ${{ github.actor }}
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Set the release version, commit the change, and tag it
run: |
mvn versions:set -B -ntp -DnewVersion=$RELEASE
git commit -am "Update version to $RELEASE"
git tag $RELEASE
- name: Release Java modules
uses: ./.github/actions/maven-release
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Set the next dev version and commit the change
run: |
mvn versions:set -B -ntp -DnewVersion=$NEXT
echo git commit -am "Update version to $NEXT"
- name: Release dev Java modules
run: |
echo mvn -B -V -ntp clean deploy -DskipTests -DskipITs
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Login to GHCR
if: github.event_name == 'workflow_call' && github.event.inputs.images != ''
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image to GHCR
if: github.event_name == 'workflow_call' && github.event.inputs.images != ''
run: |
for name in $IMAGES
do
echo docker push $name:$RELEASE
echo docker push $name:$NEXT
done
- name: Push the commits and tags
run: |
echo git push origin
echo git push origin --tags
- name: Create GitHub release
run: |
echo gh release create "$RELEASE" --generate-notes