-
-
Notifications
You must be signed in to change notification settings - Fork 11
154 lines (139 loc) · 6.05 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
next:
description: 'Next version'
required: true
jobs:
release:
runs-on: ubuntu-latest
outputs:
JAR_SIZE: ${{ steps.bach.outputs.JAR_SIZE }}
JAR_CSUM: ${{ steps.bach.outputs.JAR_CSUM }}
DOC_SIZE: ${{ steps.bach.outputs.DOC_SIZE }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ vars.JAVA_VERSION }}
distribution: ${{ vars.JAVA_DISTRO }}
cache: maven
- name: Cache Gradle
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Cache Gradle wrapper
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
restore-keys: ${{ runner.os }}-gradlew-
- name: Version
run: |
VERSION=${{ github.event.inputs.version }}
echo "Updating POMs to version $VERSION"
./mvnw -ntp -B versions:set versions:commit -DnewVersion=$VERSION
echo $VERSION > VERSION
sed -i -e "s/^\:project-version\:\ .*/:project-version: ${VERSION}/g" README.adoc
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Action"
git commit -a -m "Releasing version $VERSION"
git push origin master
- name: Stage deploy
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
run: |
./mvnw -ntp -B --file pom.xml -Ppublication -DaltDeploymentRepository=local::file:target/staging-deploy \
-Dmaven.site.skip=true -Pgradle-release deploy
- name: Release
uses: jreleaser/release-action@v2
env:
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
JRELEASER_SDKMAN_CONSUMER_KEY: ${{ secrets.SDKMAN_CONSUMER_KEY }}
JRELEASER_SDKMAN_CONSUMER_TOKEN: ${{ secrets.SDKMAN_CONSUMER_TOKEN }}
JRELEASER_TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
JRELEASER_TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
JRELEASER_TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
JRELEASER_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
JRELEASER_MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
- name: Grab bach-info
id: bach
shell: bash
run: |
VERSION=${{ github.event.inputs.version }}
JAR_SIZE=$(ls -l pomchecker-toolprovider/target/pomchecker-toolprovider-${VERSION}.jar | awk '{print $5}')
JAR_CSUM=$(shasum -a 256 pomchecker-toolprovider/target/pomchecker-toolprovider-${VERSION}.jar | awk '{print $1}')
DOC_SIZE=$(ls -l README.adoc | awk '{print $5}')
echo "JAR_SIZE=$(echo $JAR_SIZE)" >> $GITHUB_OUTPUT
echo "JAR_CSUM=$(echo $JAR_CSUM)" >> $GITHUB_OUTPUT
echo "DOC_SIZE=$(echo $DOC_SIZE)" >> $GITHUB_OUTPUT
- name: JReleaser output
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
# - name: Build site
# run: |
# export GPG_TTY=$(tty)
# ./mvnw -ntp -B --file pom.xml \
# -Drepository.url=https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git \
# site site:stage -DstagingDirectory="${{ runner.temp }}/site"
#
# - name: Publish site
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# branch: gh-pages
# folder: "${{ runner.temp }}/site"
- name: Set next version
run: |
./mvnw -ntp -B versions:set versions:commit -DnewVersion=${{ github.event.inputs.next }}
sed -i -e "[email protected]>.*</[email protected]>\${git.commit.author.time}</project.build.outputTimestamp@g" pom.xml
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Action"
git commit -a -m "Next version ${{ github.event.inputs.next }}"
git push origin master
update-bach-info:
name: Update bach-info
needs: [release]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: kordamp/bach-info
ref: 'main'
fetch-depth: 0
token: ${{ secrets.GIT_ACCESS_TOKEN }}
- name: Download bach-info script
run: |
curl -sL https://raw.githubusercontent.com/kordamp/pomchecker/master/.github/scripts/update-bach-info.sh --output update-bach-info.sh
chmod +x update-bach-info.sh
- name: Commit
env:
TAG: "v${{ github.event.inputs.version }}"
VERSION: ${{ github.event.inputs.version }}
JAR_SIZE: ${{ needs.release.outputs.JAR_SIZE }}
JAR_CSUM: ${{ needs.release.outputs.JAR_CSUM }}
DOC_SIZE: ${{ needs.release.outputs.DOC_SIZE }}
run: sh update-bach-info.sh