forked from mpetuska/kmdc
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (127 loc) · 4.59 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
name: Release
on:
push:
paths:
- '**/src/**/*'
branches:
- master
workflow_dispatch:
inputs:
version:
required: false
description: Package version to publish under
skipPages:
description: Should we skip releasing GitHub pages
required: false
default: "y"
skipMavenCentral:
description: Should we skip publishing artefacts to Maven Central
required: false
default: "y"
skipGitHub:
description: Should we skip publishing artefacts to GitHub Packages
required: false
default: "y"
release:
types: [ created ]
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=true"
concurrency:
cancel-in-progress: false
group: release-${{ github.workflow }}-${{ github.head_ref || github.ref }}
jobs:
check:
uses: ./.github/workflows/check.yml
resolve-version:
uses: ./.github/workflows/resolve-version.yml
needs: [ check ]
with:
desired-version: ${{ github.event.release.tag_name || github.event.inputs.version }}
release-Artefacts:
name: Release to ${{ matrix.repository.name }} on ${{ matrix.os.runner }}
runs-on: ${{ matrix.os.runner }}
continue-on-error: true
needs:
- check
- resolve-version
defaults:
run:
shell: ${{ matrix.os.shell }}
env:
VERSION: ${{ needs.resolve-version.outputs.version }}
GH_USERNAME: ${{ github.actor }}
GH_PASSWORD: ${{ github.token }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
strategy:
matrix:
repository:
- name: Github Packages
tasks: publishAllPublicationsToGitHubRepository
enabled: ${{ github.event.inputs.skipGitHub != 'y' }}
- name: Maven Central
# `closeSonatypeStagingRepository` Requires to manually release a new version on https://s01.oss.sonatype.org/#stagingRepositories
# If you're brave, you could change it to `closeAndReleaseSonatypeStagingRepository` to fully automate the release
tasks: publishToSonatype closeAndReleaseSonatypeStagingRepository
enabled: ${{ github.event.inputs.skipMavenCentral != 'y' }}
os:
# - runner: macos-latest
# shell: bash
# - runner: windows-latest
# shell: msys2 {0}
- runner: ubuntu-latest
shell: bash
steps:
- uses: msys2/setup-msys2@v2
if: ${{ matrix.repository.enabled == true && runner.os == 'Windows' }}
with:
release: false
msystem: MINGW64
update: true
path-type: inherit
install: >-
mingw-w64-x86_64-curl
curl
- uses: actions/checkout@v4
if: ${{ matrix.repository.enabled == true }}
- uses: actions/setup-java@v4
if: ${{ matrix.repository.enabled == true }}
with:
distribution: 'adopt'
java-version: 11
- name: Restore Gradle cache
if: ${{ matrix.repository.enabled == true }}
id: cache-gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/yarn
~/.gradle/nodejs
~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Gradle Publish to ${{ matrix.repository.name }}
if: ${{ matrix.repository.enabled == true }}
run: ./gradlew ${{ matrix.repository.tasks }} -Pversion=${VERSION//v} --scan
release-Pages:
name: Release GitHub Pages
needs: [ check, resolve-version ]
if: ${{ github.event.inputs.skipPages != 'y' && needs.resolve-version.outputs.snapshot == 'false' }}
uses: ./.github/workflows/deploy-pages.yml
with:
version: ${{ needs.resolve-version.outputs.version }}
finalise:
runs-on: ubuntu-latest
needs: [ release-Pages, resolve-version ]
if: ${{ github.event.inputs.skipPages != 'y' && needs.resolve-version.outputs.snapshot == 'false' }}
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Change pre-release status
run: gh release edit ${{ needs.resolve-version.outputs.version }} --prerelease=false