1
+ name : Maven Release
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ releaseVersion :
7
+ type : string
8
+ required : true
9
+ description : The POM release version of this release.
10
+ nextDevelopmentVersion :
11
+ type : string
12
+ required : true
13
+ description : The next POM development version with suffix "-SNAPSHOT", will be the next development version after the release is done.
14
+ dry-run :
15
+ type : boolean
16
+ required : true
17
+ description : Dry run, will not push branches or upload the artifacts.
18
+
19
+ jobs :
20
+ release :
21
+ runs-on : ubuntu-latest
22
+ steps :
23
+ - name : Validate Input
24
+ run : |
25
+ echo "${{ github.ref_type }}" | perl -ne 'die unless m/^branch$/'
26
+ echo "${{ github.ref_name }}" | perl -ne 'die unless m/^release-\d+$/'
27
+ echo "${{ github.event.inputs.releaseVersion }}" | perl -ne 'die unless m/^\d+\.\d+\.\d+$/'
28
+ echo "${{ github.event.inputs.nextDevelopmentVersion }}" | perl -ne 'die unless m/^\d+\.\d+\.\d+-SNAPSHOT$/'
29
+ - name : Checkout
30
+ uses : actions/checkout@v2
31
+ - name : Check Actor
32
+ run : |
33
+ # Release actor should be in the OWNER list
34
+ cat OWNERS | grep ${{ github.actor }}
35
+ - name : Setup Java
36
+ uses : actions/setup-java@v2
37
+ with :
38
+ distribution : ' temurin'
39
+ java-version : 8.0.x
40
+ server-id : ossrh
41
+ server-username : OSSRH_USERNAME
42
+ server-password : OSSRH_TOKEN
43
+ gpg-private-key : ${{ secrets.GPG_PRIVATE_KEY }}
44
+ gpg-passphrase : GPG_PASSPHRASE
45
+ - name : Prepare
46
+ run : |
47
+ export GPG_TTY=$(tty)
48
+ (echo 5; echo y; echo save) | gpg --command-fd 0 --no-tty --pinentry-mode loopback --passphrase ${{ secrets.GPG_PASSWORD }} --no-greeting --edit-key 'Kubernetes Client Publishers' trust
49
+ (echo 0; echo y; echo save) | gpg --command-fd 0 --no-tty --pinentry-mode loopback --passphrase ${{ secrets.GPG_PASSWORD }} --no-greeting --edit-key 'Kubernetes Client Publishers' expire
50
+ git config user.email "[email protected] "
51
+ git config user.name "Kubernetes Prow Robot"
52
+ - name : Check Current Version
53
+ run : |
54
+ mvn -q \
55
+ -Dexec.executable=echo \
56
+ -Dexec.args='${project.version}' \
57
+ --non-recursive \
58
+ exec:exec | perl -ne 'die unless m/${{ github.event.inputs.releaseVersion }}-SNAPSHOT/'
59
+ - name : Release Prepare
60
+ run : |
61
+ mvn --batch-mode \
62
+ release:prepare \
63
+ -Dtag=v${{ github.event.inputs.releaseVersion }} \
64
+ -DconnectionUrl=https://${{ github.token }}@github.com/${{ github.repository }}.git \
65
+ -DreleaseVersion=${{ github.event.inputs.releaseVersion }} \
66
+ -DdevelopmentVersion=${{ github.event.inputs.nextDevelopmentVersion }} \
67
+ -DpushChanges=false
68
+ - name : Release Perform
69
+ if : ${{ github.event.inputs.dry-run != 'true' }}
70
+ env :
71
+ OSSRH_USERNAME : ${{ secrets.SNAPSHOT_UPLOAD_USER }}
72
+ OSSRH_TOKEN : ${{ secrets.SNAPSHOT_UPLOAD_PASSWORD }}
73
+ GPG_PASSPHRASE : ${{ secrets.GPG_PASSWORD }}
74
+ run : |
75
+ # The tests are already executed in the prepare, skipping
76
+ mvn -DlocalCheckout=true -Darguments=-DskipTests release:perform
77
+ git push https://${{ github.token }}@github.com/${{ github.repository }}.git ${{ github.ref_name }}:${{ github.ref_name }}
78
+ git push https://${{ github.token }}@github.com/${{ github.repository }}.git v${{ github.event.inputs.releaseVersion }}
79
+ - name : Publish Release
80
+ if : ${{ github.event.inputs.dry-run != 'true' }}
81
+ uses : ncipollo/release-action@v1
82
+ with :
83
+ token : ${{ secrets.GITHUB_TOKEN }}
84
+ tag : v${{ github.event.inputs.releaseVersion }}
0 commit comments