-
Notifications
You must be signed in to change notification settings - Fork 21
188 lines (167 loc) · 6.66 KB
/
release.yml
File metadata and controls
188 lines (167 loc) · 6.66 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
name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-RC[0-9]+"
workflow_dispatch:
inputs:
tag:
description: "Git tag to release from"
required: true
type: string
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false
ORT_SERVER_VERSION: ${{ inputs.tag || github.ref_name }}
jobs:
release-notes:
runs-on: ubuntu-24.04
steps:
- name: Checkout Repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ env.ORT_SERVER_VERSION }}
fetch-depth: 0
- name: Setup Gradle
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
with:
dependency-graph: generate-and-submit
- name: Generate Release Notes
run: ./gradlew -q printChangeLog > RELEASE_NOTES.md
- name: Upload Release Notes
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: release-notes
path: RELEASE_NOTES.md
retention-days: 7
publish-server:
if: github.repository == 'eclipse-apoapsis/ort-server'
permissions:
contents: write
runs-on: ubuntu-24.04
steps:
- name: Checkout Repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ env.ORT_SERVER_VERSION }}
fetch-depth: 0
- name: Setup Gradle
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
with:
dependency-graph: generate-and-submit
- name: Publish to OSSRH
env:
GITHUB_DEPENDENCY_GRAPH_REF: refs/heads/main
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}
ORG_GRADLE_PROJECT_signAllPublications: true
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GPG_SUBKEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_SONATYPE_CONNECT_TIMEOUT_SECONDS: 300
ORG_GRADLE_PROJECT_SONATYPE_CLOSE_TIMEOUT_SECONDS: 3600
run: ./gradlew --stacktrace publishAndReleaseToMavenCentral
build-cli:
strategy:
matrix:
target:
- name: "Linux x64"
os: ubuntu-24.04
task: :cli:linkReleaseExecutableLinuxX64
artifact: osc-cli-linux-x64
buildPath: cli/build/bin/linuxX64/releaseExecutable/osc.kexe
binName: osc
archiveExt: tar.gz
- name: "macOS arm64"
os: macos-15
task: :cli:linkReleaseExecutableMacosArm64
artifact: osc-cli-macos-arm64
buildPath: cli/build/bin/macosArm64/releaseExecutable/osc.kexe
binName: osc
archiveExt: tar.gz
- name: "macOS x64"
os: macos-15-intel
task: :cli:linkReleaseExecutableMacosX64
artifact: osc-cli-macos-x64
buildPath: cli/build/bin/macosX64/releaseExecutable/osc.kexe
binName: osc
archiveExt: tar.gz
- name: "Windows x64"
os: windows-2025
task: :cli:linkReleaseExecutableMingwX64
artifact: osc-cli-windows-x64
buildPath: cli/build/bin/mingwX64/releaseExecutable/osc.exe
binName: osc.exe
archiveExt: zip
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ env.ORT_SERVER_VERSION }}
fetch-depth: 0
- name: Setup Java
if: runner.os == 'Windows'
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: 25
- name: Setup Gradle
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
with:
dependency-graph: generate-and-submit
- name: Build CLI
run: ./gradlew --stacktrace ${{ matrix.target.task }}
- name: Rename binaries
shell: bash
run: |
mkdir -p ${{ matrix.target.artifact }}
mv ${{ matrix.target.buildPath }} ${{ matrix.target.artifact }}/${{ matrix.target.binName }}
# Compress the binaries to reduce the size of the artifacts, to keep `osc` as the binary name, and to ensure that
# the executable permissions are preserved.
- name: Compress binaries
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
# On Windows, "bash" is "Git Bash" which does not come with the "zip" tool, so use a PowerShell command.
powershell Compress-Archive -Path ${{ matrix.target.artifact }}/${{ matrix.target.binName }} -DestinationPath ${{ matrix.target.artifact }}.${{ matrix.target.archiveExt }}
else
tar -czf ${{ matrix.target.artifact }}.${{ matrix.target.archiveExt }} -C ${{ matrix.target.artifact }} ${{ matrix.target.binName }}
fi
- name: Upload binaries
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.target.artifact }}
path: ${{ matrix.target.artifact }}.${{ matrix.target.archiveExt }}
retention-days: 7
create-release:
needs: [build-cli, publish-server, release-notes]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ env.ORT_SERVER_VERSION }}
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: artifacts/
- name: Create checksums
shell: bash
run: |
shasum --algorithm 256 ./artifacts/osc-cli-*/*.{tar.gz,zip} | sed 's|./artifacts/osc-cli-[^/]*/||' > checksums.txt
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ "$ORT_SERVER_VERSION" =~ -RC[0-9]+ ]]; then
PRERELEASE_ARG="--prerelease"
fi
gh release create $ORT_SERVER_VERSION --notes-file ./artifacts/release-notes/RELEASE_NOTES.md $PRERELEASE_ARG \
'./artifacts/osc-cli-linux-x64/osc-cli-linux-x64.tar.gz#osc-cli-linux-x64' \
'./artifacts/osc-cli-macos-arm64/osc-cli-macos-arm64.tar.gz#osc-cli-macos-arm64' \
'./artifacts/osc-cli-macos-x64/osc-cli-macos-x64.tar.gz#osc-cli-macos-x64' \
'./artifacts/osc-cli-windows-x64/osc-cli-windows-x64.zip#osc-cli-windows-x64' \
'checksums.txt#checksums'