-
Notifications
You must be signed in to change notification settings - Fork 30
63 lines (58 loc) · 2.23 KB
/
deploy.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
name: Deploy
on:
workflow_dispatch:
inputs:
previousVersion:
description: 'Previous version'
required: true
newVersion:
description: 'New version'
required: true
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Install Java and Maven
uses: actions/setup-java@v2
with:
distribution: 'adopt-hotspot'
java-version: 17
server-id: ossrh
server-username: OSSRH_USERNAME # env variable for username in deploy
server-password: OSSRH_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Release Maven package
run: mvn deploy -P deploy -Djacoco.skip=true
env:
OSSRH_USERNAME: ${{ secrets.NEXUS_USERNAME }}
OSSRH_TOKEN: ${{ secrets.NEXUS_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Create and push tag
run: |
git config --global user.email "[email protected]"
git config --global user.name "$GITHUB_ACTOR"
git tag -a $TAG -m "Release v$TAG"
git push origin $TAG
env:
TAG: ${{ github.event.inputs.newVersion }}
- name: Create Release on GitHub
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.newVersion }}
release_name: ${{ github.event.inputs.newVersion }}
draft: true
prerelease: false
- name: Update README
run: |
sed -i 's/${{ github.event.inputs.previousVersion }}/${{ github.event.inputs.newVersion }}/g' README.md
git config --global user.email "[email protected]"
git config --global user.name "$GITHUB_ACTOR"
git commit -am "Replace ${{ github.event.inputs.previousVersion }} with ${{ github.event.inputs.newVersion }} in the README"
git push origin master