-
Notifications
You must be signed in to change notification settings - Fork 2.3k
162 lines (156 loc) · 5.87 KB
/
Copy pathrelease.yml
File metadata and controls
162 lines (156 loc) · 5.87 KB
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
name: Release
on:
workflow_dispatch:
branches: ["master"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/create-github-app-token@v3
id: generate-token
with:
client-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Set up Java 11
uses: actions/setup-java@v5
with:
java-version: 11
distribution: temurin
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }}
- name: Cache local Maven repository
uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Gradle credentials
run: |
mkdir -p ~/.gradle
echo "gradle.publish.key=${GRADLE_PUBLISH_KEY}\ngradle.publish.secret=${GRADLE_PUBLISH_SECRET}" > ~/.gradle/gradle.properties
- name: Check swagger-bom version matches root version
run: |
ROOT_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
BOM_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec --file modules/swagger-bom/pom.xml)
echo "Root version: ${ROOT_VERSION}"
echo "BOM version: ${BOM_VERSION}"
if [ "${ROOT_VERSION}" != "${BOM_VERSION}" ]; then
echo "ERROR: swagger-bom version (${BOM_VERSION}) does not match root version (${ROOT_VERSION}). Update modules/swagger-bom/pom.xml."
exit 1
fi
- name: Run pre release script
id: preRelease
run: |
# export GPG_TTY=$(tty)
export MY_POM_VERSION=`./mvnw -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
if [[ $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
then
echo "not releasing snapshot version: " ${MY_POM_VERSION}
echo "RELEASE_OK=no" >> $GITHUB_ENV
else
. ./CI/pre-release.sh
echo "RELEASE_OK=yes" >> $GITHUB_ENV
fi
echo "SC_VERSION=$SC_VERSION" >> $GITHUB_ENV
echo "SC_NEXT_VERSION=$SC_NEXT_VERSION" >> $GITHUB_ENV
echo "SC_LAST_RELEASE=$SC_LAST_RELEASE" >> $GITHUB_ENV
- name: configure git user email
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git config --global hub.protocol https
git remote set-url origin https://\${{ secrets.GITHUB_TOKEN }}:x-oauth-basic@github.com/''' + 'swagger-api/swagger-core' + '''.git
- name: Run maven deploy/release
if: env.RELEASE_OK == 'yes'
run: |
./mvnw --no-transfer-progress -B -Prelease deploy
- name: Run prepare javadocs script
id: prepareJavadocs
if: env.RELEASE_OK == 'yes'
run: |
. ./CI/prepare-javadocs.sh
- name: Checkout gh-pages
uses: actions/checkout@v6
with:
ref: "gh-pages"
fetch-depth: 0
- name: Run publish javadocs script
id: publishJavadocs
if: env.RELEASE_OK == 'yes'
run: |
TMPDIR="$(dirname -- "${0}")"
. $TMPDIR/publish-javadocs.sh
- name: Checkout master
uses: actions/checkout@v6
with:
ref: "master"
fetch-depth: 0
- name: Run post release script
id: postRelease
if: env.RELEASE_OK == 'yes'
run: |
. ./CI/post-release.sh
- name: Create Next Snapshot Pull Request
uses: peter-evans/create-pull-request@v8
if: env.RELEASE_OK == 'yes'
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: bump snapshot ${{ env.SC_NEXT_VERSION }}-SNAPSHOT
title: 'bump snapshot ${{ env.SC_NEXT_VERSION }}-SNAPSHOT'
branch: bump-snap-${{ env.SC_NEXT_VERSION }}-SNAPSHOT
- name: Checkout 1.5
uses: actions/checkout@v6
with:
ref: "1.5"
fetch-depth: 0
- name: updateV1Readme script
id: updateV1Readme
if: env.RELEASE_OK == 'yes'
run: |
TMPDIR="$(dirname -- "${0}")"
. $TMPDIR/update-v1-readme.sh ${{ env.SC_LAST_RELEASE }} ${{ env.SC_VERSION }}
- name: Create Update V1 Readme Pull Request
uses: peter-evans/create-pull-request@v8
if: env.RELEASE_OK == 'yes'
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: update 1.5 Readme with new v2 version ${{ env.SC_VERSION }}
title: 'update 1.5 Readme with new v2 version ${{ env.SC_VERSION }}'
branch: update-v1-readme-${{ env.SC_VERSION }}
- name: Checkout Wiki
uses: actions/checkout@v6
with:
repository: swagger-api/swagger-core.wiki
token: ${{ steps.generate-token.outputs.token }}
path: wiki
ref: "master"
fetch-depth: 0
- name: Run update wiki script
id: updateWiki
if: env.RELEASE_OK == 'yes'
run: |
TMPDIR="$(dirname -- "${0}")"
. $TMPDIR/update-wiki.sh
- name: Checkout master
uses: actions/checkout@v6
with:
ref: "master"
fetch-depth: 0
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SC_VERSION:
SC_NEXT_VERSION:
GPG_PRIVATE_KEY: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_PRIVATE_PASSPHRASE }}
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}