-
-
Notifications
You must be signed in to change notification settings - Fork 281
134 lines (127 loc) · 3.5 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
name: Release
on:
push:
branches: [master]
tags: ["v*"]
jobs:
publish:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Scala caches
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
~/.cache/coursier
key: ${{ runner.os }}-sbt-docs-${{ hashFiles('**/*.sbt') }}
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: temurin
- uses: actions/setup-node@v3
with:
node-version: '12.x'
- uses: olafurpg/setup-gpg@v3
if: startsWith(github.ref, 'refs/tags/v')
- name: Publish ${{ github.ref }}
run: sbt ci-release
env:
JAVA_OPTS: -Xmx4G -XX:+UseG1GC
JVM_OPTS: -Xmx4G -XX:+UseG1GC
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
- name: Update docs
run: |
git config --global user.name "ScalaPB Docs"
git config --global user.email "scalapb-updater@users.noreply.github.com"
eval "$(ssh-agent -s)"
echo "$TOKEN" | ssh-add -
sbt docs/mdoc docs/unidoc
cd website
yarn install
yarn deploy
env:
TOKEN: ${{secrets.DEPLOY_KEY}}
USE_SSH: true
GIT_USER: git
scalapbc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: temurin
- run: |
sbt scalapbcJVM2_12/universal:packageBin
- uses: actions/upload-artifact@v3
with:
name: scalapbc
path: scalapbc/target/jvm-2.12/universal/scalapbc-*.zip
native:
strategy:
matrix:
include:
- os: ubuntu-latest
arch: linux-x86_64
- os: macos-12
arch: osx-x86_64
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v13
with:
java-version: graalvm@21.1.0
- name: Asset name
id: vars
run: |
if [[ $GITHUB_REF = refs/tags/v* ]]; then
RELEASE_VERSION=${GITHUB_REF#refs/tags/v}
else
RELEASE_VERSION=SNAPSHOT
fi
echo "ASSET=protoc-gen-scala-${RELEASE_VERSION}-${{matrix.arch}}" >> $GITHUB_ENV
- name: build native image
run: |
set -x
gu install native-image
./make_reflect_config.sh
sbt protocGenScalaNativeImage/nativeImage
zip -j $ASSET.zip target/protoc-gen-scala
- uses: actions/upload-artifact@v3
with:
name: ${{env.ASSET}}
path: ${{env.ASSET}}.zip
gh_release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-20.04
needs: [native, scalapbc]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R
working-directory: ./artifacts
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
assets=$(find ./artifacts -name "*.zip" -printf "-a %p ")
RELEASE_NAME=${GITHUB_REF#refs/tags/}
hub release create ${assets} -m "$RELEASE_NAME" "$RELEASE_NAME"