-
Notifications
You must be signed in to change notification settings - Fork 13
179 lines (157 loc) · 6.14 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Release
on:
workflow_dispatch:
inputs:
branch:
description: "The infinispan-quarkus branch to checkout when cutting the release."
required: true
default: "14.0.x"
infinispanVersion:
description: "Infinispan version to use for the release."
required: true
default: "X.Y.Z"
currentVersion:
description: "The current SNAPSHOT version of the branch to cut the release from."
required: true
releaseVersion:
description: "Release version."
required: true
default: "X.Y.Z"
developmentVersion:
description: "Next development version."
required: true
default: "X.Y.Z-SNAPSHOT"
jobs:
release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.3'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git User
run: |
git config user.email "[email protected]"
git config user.name "Infinispan"
- name: Tag release
run: |
sed -i '9s/<version>.*<\/version>/<version>${{ github.event.inputs.infinispanVersion }}<\/version>/' pom.xml
find . -name "pom.xml" | xargs sed -i 's/<version>${{ github.event.inputs.currentVersion }}<\/version>/<version>${{ github.event.inputs.releaseVersion }}<\/version>/g'
grep SNAPSHOT --include pom.xml --recursive . && exit 1
git commit -a -m "Releasing ${{ github.event.inputs.releaseVersion }}"
git tag ${{ github.event.inputs.releaseVersion }}
sed -i '9s/<version>.*<\/version>/<version>${{ github.event.inputs.developmentVersion }}<\/version>/' pom.xml
find . -name "pom.xml" | xargs sed -i 's/<version>${{ github.event.inputs.releaseVersion }}<\/version>/<version>${{ github.event.inputs.developmentVersion }}<\/version>/g'
git commit -a -m "Next version ${{ github.event.inputs.developmentVersion }}"
# Ensure the tagged release can be be built
- name: Build release
run: |
git checkout ${{ github.event.inputs.releaseVersion }}
./mvnw package -s maven-settings.xml -DskipTests=true -Prelease
git checkout ${{ github.event.inputs.branch }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.event.inputs.branch }}
tags: true
- id: release
name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.releaseVersion }}
release_name: ${{ github.event.inputs.releaseVersion }}
publish:
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.releaseVersion }}
- name: Set up Java for publishing to OSSRH
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.INFINISPAN_MAVEN_GPG_ARMORED }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to OSSRH
run: ./mvnw -B deploy -Prelease -Pcommunity-release -DskipTests -Dmaven.javadoc.skip=true -P \!native -pl \!integration-tests/server
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.INFINISPAN_MAVEN_GPG_PASSPHRASE }}
build:
needs: release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2022]
include:
- os: ubuntu-latest
asset_name: linux-amd64
gu_binary: gu
- os: macos-latest
asset_name: darwin-amd64
gu_binary: gu
- os: windows-2022
asset_name: windows-amd64
gu_binary: gu.cmd
steps:
- uses: actions/checkout@v2
- if: ${{ matrix.os == 'windows-2022' }}
name: Add msbuild to PATH
uses: microsoft/[email protected]
- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.0'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Release Tag
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.releaseVersion }}
- if: ${{ matrix.os == 'windows-2022' }}
name: Build native executable
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
mvnw.cmd package -s maven-settings.xml -Pdistribution -Pwindows -Pnative -am -pl cli -Prelease
shell: cmd
- if: ${{ matrix.os != 'windows-2022' }}
name: Build native executable
run: ./mvnw package -s maven-settings.xml -Pdistribution -Pnative -am -pl cli -Prelease
- name: Upload CLI native executable
id: upload-cli-native-executable
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./cli/target/infinispan-cli-${{ github.event.inputs.releaseVersion }}.zip
asset_name: infinispan-cli-${{ github.event.inputs.releaseVersion }}-${{ matrix.asset_name }}.zip
asset_content_type: application/zip