-
Notifications
You must be signed in to change notification settings - Fork 0
200 lines (175 loc) · 6.17 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
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
name: Release
on:
push:
branches:
- main
- 'logger-f-1'
tags:
- '*'
env:
GH_JAVA_VERSION: "11"
GH_JAVA_DISTRIBUTION: "temurin"
GH_JAVA_OPTS: "-Xss64m -Xms1024m -XX:MaxMetaspaceSize=2G -Xmx4G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
scala:
- { name: "Scala 2", version: "2.12.13", binary-version: "2.12", java-version: "11", java-distribution: "temurin", report: "" }
- { name: "Scala 2", version: "2.13.6", binary-version: "2.13", java-version: "11", java-distribution: "temurin", report: "" }
- { name: "Scala 3", version: "3.0.2", binary-version: "3", java-version: "11", java-distribution: "temurin", report: "" }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.scala.java-version }}
distribution: ${{ matrix.scala.java-distribution }}
- name: Cache SBT
uses: actions/cache@v4
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: ${{ runner.os }}-sbt-${{ matrix.scala.binary-version }}-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-sbt-${{ matrix.scala.binary-version }}-
- name: "[Push] Build All for ${{ matrix.scala.name }}: ${{ matrix.scala.version }} - ${{ github.run_number }}"
env:
CURRENT_BRANCH_NAME: ${{ github.ref }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
JAVA_OPTS: ${{ env.GH_JAVA_OPTS }}
run: |
echo "[BEFORE]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}"
export CURRENT_BRANCH_NAME="${CURRENT_BRANCH_NAME#refs/heads/}"
echo " [AFTER]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}"
echo "RUN_ID=${RUN_ID}"
echo "RUN_NUMBER=${RUN_NUMBER}"
echo "Push #${PUSH_NUMBER}"
echo "JAVA_OPTS=${JAVA_OPTS}"
echo "SBT_OPTS=${SBT_OPTS}"
java -version
sbt \
++${{ matrix.scala.version }}! \
-v \
clean \
test
gh-release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ env.GH_JAVA_VERSION }}
distribution: ${{ env.GH_JAVA_DISTRIBUTION }}
- name: Cache SBT
uses: actions/cache@v4
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-sbt
- name: sbt GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_AUTH_TOKEN_GITHUB }}
JAVA_OPTS: ${{ env.GH_JAVA_OPTS }}
run: |
echo "Run] sbt GitHub release"
echo "JAVA_OPTS=${JAVA_OPTS}"
echo "SBT_OPTS=${SBT_OPTS}"
echo 'sbt devOopsGitHubRelease'
sbt \
-v \
devOopsGitHubRelease
publish:
needs: gh-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: ${{ env.GH_JAVA_VERSION }}
distribution: ${{ env.GH_JAVA_DISTRIBUTION }}
- uses: olafurpg/setup-gpg@v3
- name: Cache SBT
uses: actions/cache@v4
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-sbt
- name: "sbt ci-release - ${{ github.run_number }}"
if: startsWith(github.ref, 'refs/tags/v')
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
GITHUB_TOKEN: ${{ secrets.RELEASE_AUTH_TOKEN_GITHUB }}
JAVA_OPTS: ${{ env.GH_JAVA_OPTS }}
run: |
echo "Run] sbt ci-release"
export SOURCE_DATE_EPOCH=$(date +%s)
echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH"
echo "JAVA_OPTS=${JAVA_OPTS}"
echo "SBT_OPTS=${SBT_OPTS}"
echo 'sbt -v clean +packagedArtifacts ci-release'
sbt \
-v \
clean \
+packagedArtifacts \
ci-release
publish-snapshot:
if: startsWith(github.ref, 'refs/heads/')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: ${{ env.GH_JAVA_VERSION }}
distribution: ${{ env.GH_JAVA_DISTRIBUTION }}
- uses: olafurpg/setup-gpg@v3
- name: Cache SBT
uses: actions/cache@v4
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-sbt
- name: "sbt ci-release (no tag) - ${{ github.run_number }}"
if: startsWith(github.ref, 'refs/heads/')
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
JAVA_OPTS: ${{ env.GH_JAVA_OPTS }}
run: |
echo "Run] sbt ci-release"
export SOURCE_DATE_EPOCH=$(date +%s)
echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH"
echo "JAVA_OPTS=${JAVA_OPTS}"
echo "SBT_OPTS=${SBT_OPTS}"
sbt \
-v \
clean \
+packagedArtifacts \
ci-release