-
Notifications
You must be signed in to change notification settings - Fork 2
133 lines (114 loc) · 4.17 KB
/
manual-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
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
123
124
125
126
127
128
129
130
131
132
133
name: Manual Deployment to Maven Central
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "👷 Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "🔑 Import GPG Key"
run: |
echo "${{ secrets.MAVEN_GPG_PRIVATE_KEY }}" | base64 -d | gpg --batch --import
- name: "☕ Set up java"
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: maven
- name: "🔧 Compile"
run: mvn compile
publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: "👷 Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "🔑 Create settings-security.xml"
run: |
echo $HOME
mkdir -p "$HOME/.m2"
ls -la "$HOME/.m2"
echo "<settingsSecurity><master>${{ secrets.MAVEN_MASTER_PASSWORD }}</master></settingsSecurity>" > "$HOME/.m2/settings-security.xml"
- name: "🔑 Import GPG Key"
run: |
echo "${{ secrets.MAVEN_GPG_PRIVATE_KEY }}" | base64 -d | gpg --batch --import
- name: "🛠 Configure GPG to Allow Loopback"
run: |
mkdir -p ~/.gnupg
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
echo "use-agent" >> ~/.gnupg/gpg.conf
gpgconf --reload gpg-agent
- name: "☕ Set up java"
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: maven
server-id: ossrh
server-username: ${{ secrets.OSSRH_USERNAME }}
server-password: ${{ secrets.OSSRH_TOKEN }}
- name: "🗽 Publish package"
run: mvn clean deploy -DskipTests -Prelease -Dgpg.passphrase=${{ secrets.MAVEN_GPG_PASSPHRASE }}
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
tag_release:
needs: publish
runs-on: ubuntu-latest
steps:
- name: "👷 Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "📎 Install xmllint"
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
- name: "📑 Setup release information"
run: |
pom_version=`xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml`
echo "POM_VERSION=$pom_version" >> $GITHUB_ENV
- name: "✏️ Generate release changelog"
id: extract-release-changelog
uses: heinrichreimer/github-changelog-generator-action@v2.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
unreleasedOnly: "true"
stripHeaders: "true"
stripGeneratorNotice: "true"
futureRelease: ${{ env.POM_VERSION }}
- name: "📍 Create release"
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.POM_VERSION }}
release_name: v${{ env.POM_VERSION }}
draft: false
prerelease: false
body: ${{ steps.extract-release-changelog.outputs.changelog }}
- name: "✏️ Generate full changelog"
id: extract-changelog
uses: heinrichreimer/github-changelog-generator-action@v2.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
stripGeneratorNotice: "true"
- name: "⛲ Commit files"
env:
CI_USER: github-actions
CI_EMAIL: github-actions@github.com
run: |
git config --local user.email "$CI_EMAIL"
git config --local user.name "$CI_USER"
git status
git add CHANGELOG.md && git commit -m 'Updated CHANGELOG.md' && echo "push=true" >> $GITHUB_ENV || echo "No changes to CHANGELOG.md"
- name: "⏫ Push changes"
if: env.push == 'true'
env:
CI_USER: github-actions
CI_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push "https://$CI_USER:$CI_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:master