-
Notifications
You must be signed in to change notification settings - Fork 3
148 lines (147 loc) · 5.84 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
name: Release
run-name: 'Release: ${{ github.ref }}'
on:
workflow_dispatch:
inputs:
version:
description: 'Version (vX.Y.Z or vX.Y.Z-suf.V)'
default: null
jobs:
check:
strategy:
matrix:
config:
- {os: ubuntu-latest, preset: linuxX64}
- {os: windows-latest, preset: mingwX64}
- {os: macos-12, preset: macosX64}
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 8.0
distribution: corretto
- uses: gradle/wrapper-validation-action@v1
- if: matrix.config.preset == 'linuxX64' || matrix.config.preset == 'macosX64'
run: chmod +x ${{ github.workspace }}/gradlew
- if: matrix.config.preset == 'linuxX64' || matrix.config.preset == 'macosX64'
run: chmod +x ${{ github.workspace }}/setup-shared-libs.sh
- if: matrix.config.preset == 'linuxX64'
run: sudo apt-get install -y libtinfo5
- if: matrix.config.preset == 'linuxX64' || matrix.config.preset == 'macosX64'
run: ${{ github.workspace }}/setup-shared-libs.sh
- if: matrix.config.preset == 'mingwX64'
run: ${{ github.workspace }}/setup-shared-libs.bat
- uses: gradle/gradle-build-action@v2
with:
arguments: check
- if: always()
uses: actions/upload-artifact@v3
with:
name: test-reports-${{ matrix.config.preset }}
path: ${{ github.workspace }}/*/build/reports/*
release:
needs: check
runs-on: ubuntu-latest
outputs:
tag: ${{ inputs.version != null && inputs.version || steps.next-tag.outputs.tag }}
version: ${{ steps.version.outputs.version }}
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- if: inputs.version == null
uses: actions/checkout@v3
with:
fetch-depth: 0
- if: inputs.version == null
id: next-tag
uses: Drill4J/semver-tag-action@v0.2.0
with:
type: ${{ github.ref_name == 'main' && 'patch' || 'prerelease' }}
- uses: actions/create-release@v1
id: create-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ inputs.version != null && inputs.version || steps.next-tag.outputs.tag }}
release_name: ${{ inputs.version != null && inputs.version || steps.next-tag.outputs.tag }}
prerelease: ${{ github.ref_name != 'main' }}
- run: echo version=${tag#v} >> $GITHUB_OUTPUT
id: version
env:
tag: ${{ inputs.version != null && inputs.version || steps.next-tag.outputs.tag }}
assets:
needs: release
strategy:
matrix:
config:
- {os: ubuntu-latest, preset: linuxX64}
- {os: windows-latest, preset: mingwX64}
- {os: macos-12, preset: macosX64}
runs-on: ${{ matrix.config.os }}
outputs:
tag: ${{ needs.release.outputs.tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: 8.0
distribution: corretto
- uses: gradle/wrapper-validation-action@v1
- if: matrix.config.preset == 'linuxX64' || matrix.config.preset == 'macosX64'
run: chmod +x ${{ github.workspace }}/gradlew
- if: matrix.config.preset == 'linuxX64' || matrix.config.preset == 'macosX64'
run: chmod +x ${{ github.workspace }}/setup-shared-libs.sh
- if: matrix.config.preset == 'linuxX64'
run: sudo apt-get install -y libtinfo5
- if: matrix.config.preset == 'linuxX64' || matrix.config.preset == 'macosX64'
run: ${{ github.workspace }}/setup-shared-libs.sh
- if: matrix.config.preset == 'mingwX64'
run: ${{ github.workspace }}/setup-shared-libs.bat
- uses: gradle/gradle-build-action@v2
with:
arguments: assemble
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build/distributions/${{ matrix.config.preset }}-${{ needs.release.outputs.version }}.zip
asset_name: agent-${{ matrix.config.preset }}-${{ needs.release.outputs.version }}.zip
asset_content_type: application/zip
tagging:
if: ${{ !startsWith(github.ref_name, 'release/') }}
needs: assets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: 8.0
distribution: corretto
- uses: gradle/wrapper-validation-action@v1
- run: chmod +x ${{ github.workspace }}/gradlew
- run: chmod +x ${{ github.workspace }}/setup-shared-libs.sh
- run: ${{ github.workspace }}/setup-shared-libs.sh
- run: 'git switch -c release/${{ needs.assets.outputs.tag }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: gradle/gradle-build-action@v2
env:
SHARED_LIBS_USER: ${{ secrets.GH_PACKAGE_USERNAME }}
SHARED_LIBS_PASSWORD: ${{ secrets.GH_PACKAGE_TOKEN }}
with:
arguments: tagSharedLibs
- run: 'git commit -am "release: branch ${{ needs.assets.outputs.tag }}"'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: runner
GIT_AUTHOR_EMAIL: runner@users.noreply.github.com
GIT_COMMITTER_NAME: runner
GIT_COMMITTER_EMAIL: runner@users.noreply.github.com
- run: 'git push origin release/${{ needs.assets.outputs.tag }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}