-
-
Notifications
You must be signed in to change notification settings - Fork 2
217 lines (208 loc) · 7.59 KB
/
publish-release.yml
File metadata and controls
217 lines (208 loc) · 7.59 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Publish release
on:
workflow_call:
inputs:
mutation-testing:
required: false
type: boolean
default: true
sonarqube:
required: false
type: boolean
default: ${{ !github.event.pull_request.head.repo.fork }}
project-name:
required: true
type: string
announce:
required: false
type: boolean
default: true
curseforge:
required: false
type: boolean
default: false
modrinth:
required: false
type: boolean
default: false
javadoc:
required: false
type: boolean
default: true
gametests:
required: false
type: boolean
default: false
jobs:
extract-version-number:
name: Extract version number
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true &&
(startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix/'))
outputs:
version: ${{ env.RELEASE_VERSION }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract version from release branch name
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract version from hotfix branch name
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#hotfix/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
extract-changelog:
name: Extract changelog
runs-on: ubuntu-latest
needs: extract-version-number
outputs:
changelog: ${{ steps.changelog_reader.outputs.changes }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract changelog
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ needs.extract-version-number.outputs.version }}
path: ./CHANGELOG.md
build:
name: Build
needs: extract-version-number
uses: ./.github/workflows/build.yml
with:
version: ${{ needs.extract-version-number.outputs.version }}
mutation-testing: ${{ inputs.mutation-testing }}
sonarqube: ${{ inputs.sonarqube }}
gametests: ${{ inputs.gametests }}
secrets: inherit
publish-maven:
name: Publish Maven packages
runs-on: ubuntu-latest
needs: [ build, extract-version-number ]
env:
RELEASE_VERSION: ${{ needs.extract-version-number.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: refinedmods/refinedarchitect/.github/actions/setup-java@develop
- name: Publish to Maven
run: ./gradlew --no-configuration-cache publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CREEPERHOST_MAVEN_USERNAME: ${{ secrets.CREEPERHOST_MAVEN_USERNAME }}
CREEPERHOST_MAVEN_TOKEN: ${{ secrets.CREEPERHOST_MAVEN_TOKEN }}
publish-javadoc:
name: Publish Javadoc
runs-on: ubuntu-latest
needs: [ build, extract-version-number ]
if: ${{ inputs.javadoc == true }}
env:
RELEASE_VERSION: ${{ needs.extract-version-number.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: refinedmods/refinedarchitect/.github/actions/setup-java@develop
- name: Build documentation
run: ./gradlew javadocAggregate
- name: Publish documentation
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build/docs/javadoc
target-folder: ${{ github.event.repository.name }}
token: ${{ secrets.JAVADOC_PUSH_TOKEN }}
repository-name: refinedmods/javadoc
deploy-github-releases:
name: Deploy to GitHub Releases
runs-on: ubuntu-latest
needs: [ build, extract-version-number, extract-changelog ]
outputs:
release-url: ${{ steps.gh_release.outputs.url }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: Artifacts
- name: Deploy to GitHub Releases
uses: softprops/action-gh-release@v0.1.15
id: gh_release
with:
body: ${{ needs.extract-changelog.outputs.changelog }}
name: 'v${{ needs.extract-version-number.outputs.version }}'
tag_name: 'v${{ needs.extract-version-number.outputs.version }}'
target_commitish: ${{ github.event.pull_request.merge_commit_sha }}
files: |
**/build/libs/*.jar
deploy-curseforge:
name: Deploy to CurseForge
runs-on: ubuntu-latest
needs: [ build, extract-version-number, extract-changelog ]
if: ${{ inputs.curseforge == true }}
env:
RELEASE_VERSION: ${{ needs.extract-version-number.outputs.version }}
RELEASE_CHANGELOG: ${{ needs.extract-changelog.outputs.changelog }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: refinedmods/refinedarchitect/.github/actions/setup-java@develop
- name: Deploy to CurseForge
run: ./gradlew --no-configuration-cache publishCurseforge
deploy-modrinth:
name: Deploy to Modrinth
runs-on: ubuntu-latest
needs: [ build, extract-version-number, extract-changelog ]
if: ${{ inputs.modrinth == true }}
env:
RELEASE_VERSION: ${{ needs.extract-version-number.outputs.version }}
RELEASE_CHANGELOG: ${{ needs.extract-changelog.outputs.changelog }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: refinedmods/refinedarchitect/.github/actions/setup-java@develop
- name: Deploy to Modrinth
run: ./gradlew --no-configuration-cache publishModrinth
announce-discord:
name: Announce to Discord
runs-on: ubuntu-latest
needs: [ deploy-github-releases, extract-version-number ]
if: ${{ inputs.announce == true }}
env:
RELEASE_VERSION: ${{ needs.extract-version-number.outputs.version }}
RELEASE_URL: ${{ needs.deploy-github-releases.outputs.release-url }}
PROJECT_NAME: ${{ inputs.project-name }}
steps:
- name: Announce to Discord
uses: Ilshidur/action-discord@0.3.2
with:
args: '{{ PROJECT_NAME }} v{{ RELEASE_VERSION }} has been released! {{ RELEASE_URL }}'
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
sync-develop:
name: Sync develop
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true &&
(startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix/'))
steps:
- name: Create PR for merging main back into develop
uses: thomaseizinger/create-pull-request@52baa147b387effeeb9cf04e121227dbfb74994e
env:
GITHUB_TOKEN: ${{ secrets.GITFLOW_PUSH_TOKEN }}
with:
head: main
base: develop
title: Merge main into develop branch
body: |
This PR merges the main branch back into develop.
This is to ensure that the updates that happened on the release branch, i.e. CHANGELOG and version updates are also present on the develop branch.