Skip to content

Commit edec531

Browse files
committed
CI: Update release pipeline to deploy full releases
This splits up the release pipeline into a pre-release pipeline and a release pipeline. The prerelease pipeline, in addition to creating the release builds also: - Uploads the artifacts to maven - Creates a draft release on Github The release pipeline now: - Runs as soon as the draft release on Github is released - Pushes the docker images to Docker Hub
1 parent 94b558c commit edec531

File tree

3 files changed

+159
-74
lines changed

3 files changed

+159
-74
lines changed

.github/workflows/prerelease.yaml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Pre-Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build_release:
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
include:
12+
- os: ubuntu-20.04
13+
name: linux
14+
- os: macos-11
15+
name: macos
16+
- os: windows-2019
17+
name: windows
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Set up JDK
23+
uses: actions/setup-java@v3
24+
with:
25+
distribution: zulu
26+
java-version: 8
27+
28+
- name: Set Build Buddy config
29+
shell: bash
30+
run: .github/scripts/echoBuildBuddyConfig.sh ${{ secrets.BUILDBUDDY_API_KEY }} >> $GITHUB_ENV
31+
32+
- name: Append build settings to .bazelrc
33+
shell: bash
34+
run: |
35+
echo "build --announce_rc" >> .bazelrc
36+
echo "build:linux --config=toolchain" >> .bazelrc
37+
echo "build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux" >> .bazelrc
38+
39+
- name: Build
40+
shell: bash
41+
# Double forward slashes are converted to single ones by Git Bash on Windows, so we use working directory
42+
# relative labels instead.
43+
run: |
44+
bazelisk build ${{env.BUILD_BUDDY_CONFIG}} deploy:jazzer :jazzer_release
45+
cp -L $(bazel cquery --output=files deploy:jazzer) jazzer-${{ matrix.name }}.jar
46+
cp -L $(bazel cquery --output=files :jazzer_release) jazzer-${{ matrix.name }}.tar.gz
47+
48+
- name: Upload jazzer.jar
49+
uses: actions/upload-artifact@v3
50+
with:
51+
name: jazzer_tmp
52+
path: jazzer-${{ matrix.name }}.jar
53+
if-no-files-found: error
54+
55+
- name: Upload release archive
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: jazzer_releases
59+
path: jazzer-${{ matrix.name }}.tar.gz
60+
if-no-files-found: error
61+
62+
merge_jars:
63+
runs-on: ubuntu-latest
64+
needs: build_release
65+
66+
steps:
67+
- uses: actions/checkout@v3
68+
69+
- name: Download individual jars
70+
uses: actions/download-artifact@v3
71+
with:
72+
name: jazzer_tmp
73+
path: _tmp/
74+
75+
- name: Merge jars
76+
run: |
77+
bazel run @rules_jvm_external//private/tools/java/com/github/bazelbuild/rules_jvm_external/jar:MergeJars -- \
78+
--output "$(pwd)"/_tmp/jazzer.jar \
79+
$(find "$(pwd)/_tmp/" -name '*.jar' -printf "--sources %h/%f ")
80+
81+
- name: Upload merged jar
82+
uses: actions/upload-artifact@v3
83+
with:
84+
name: jazzer
85+
path: _tmp/jazzer.jar
86+
if-no-files-found: error
87+
88+
maven_predeploy:
89+
runs-on: ubuntu-latest
90+
needs: merge_jars
91+
92+
environment:
93+
name: Deploy
94+
95+
steps:
96+
- uses: actions/checkout@v3
97+
98+
- name: Download merged jar
99+
uses: actions/download-artifact@v3
100+
with:
101+
name: jazzer
102+
path: _tmp/
103+
104+
- name: Run Deployment
105+
env:
106+
RELEASE_SIGNING_KEY_ID: ${{ secrets.RELEASE_SIGNING_KEY_ID }}
107+
RELEASE_SIGNING_KEY_PRIVATE: ${{ secrets.RELEASE_SIGNING_KEY_PRIVATE }}
108+
MAVEN_USER: ${{ secrets.MAVEN_USER }}
109+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
110+
run: JAZZER_JAR_PATH="$(pwd)/_tmp/jazzer.jar" bazel run deploy
111+
112+
create_release:
113+
needs: build_release
114+
runs-on: ubuntu-latest
115+
116+
permissions:
117+
contents: write # for creating releases
118+
119+
steps:
120+
- name: checkout
121+
uses: actions/checkout@v3
122+
123+
- name: Download individual tar.gzs
124+
uses: actions/download-artifact@v3
125+
with:
126+
name: jazzer_releases
127+
path: _releases/
128+
129+
- name: read version
130+
id: read-version
131+
run: |
132+
echo ::set-output name=version::\
133+
$(sed -nr 's/JAZZER_VERSION = "(.*)"/\1/p' maven.bzl)
134+
shell: bash
135+
136+
- name: create release
137+
uses: softprops/action-gh-release@v1
138+
with:
139+
name: v${{ steps.read-version.outputs.version }}
140+
tag_name: v${{ steps.read-version.outputs.version }}
141+
generate_release_notes: true
142+
draft: true
143+
files: |
144+
_releases/jazzer-linux.tar.gz
145+
_releases/jazzer-macos.tar.gz
146+
_releases/jazzer-windows.tar.gz

.github/workflows/release.yml

Lines changed: 10 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2,85 +2,21 @@ name: Release
22

33
on:
44
workflow_dispatch:
5+
release:
6+
types: [released]
57

68
jobs:
7-
build_release:
8-
runs-on: ${{ matrix.os }}
9-
strategy:
10-
matrix:
11-
include:
12-
- os: ubuntu-20.04
13-
name: linux
14-
- os: macos-11
15-
name: macos
16-
- os: windows-2019
17-
name: windows
18-
19-
steps:
20-
- uses: actions/checkout@v3
21-
22-
- name: Set up JDK
23-
uses: actions/setup-java@v3
24-
with:
25-
distribution: zulu
26-
java-version: 8
27-
28-
- name: Set Build Buddy config
29-
shell: bash
30-
run: .github/scripts/echoBuildBuddyConfig.sh ${{ secrets.BUILDBUDDY_API_KEY }} >> $GITHUB_ENV
31-
32-
- name: Append build settings to .bazelrc
33-
shell: bash
34-
run: |
35-
echo "build --announce_rc" >> .bazelrc
36-
echo "build:linux --config=toolchain" >> .bazelrc
37-
echo "build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux" >> .bazelrc
38-
39-
- name: Build
40-
shell: bash
41-
# Double forward slashes are converted to single ones by Git Bash on Windows, so we use working directory
42-
# relative labels instead.
43-
run: |
44-
bazelisk build ${{env.BUILD_BUDDY_CONFIG}} deploy:jazzer :jazzer_release
45-
cp -L $(bazel cquery --output=files deploy:jazzer) jazzer-${{ matrix.name }}.jar
46-
cp -L $(bazel cquery --output=files :jazzer_release) jazzer-${{ matrix.name }}.tar.gz
47-
48-
- name: Upload jazzer.jar
49-
uses: actions/upload-artifact@v3
50-
with:
51-
name: jazzer_tmp
52-
path: jazzer-${{ matrix.name }}.jar
53-
if-no-files-found: error
54-
55-
- name: Upload release archive
56-
uses: actions/upload-artifact@v3
57-
with:
58-
name: jazzer_releases
59-
path: jazzer-${{ matrix.name }}.tar.gz
60-
if-no-files-found: error
61-
62-
merge_jars:
9+
docker_push:
6310
runs-on: ubuntu-latest
64-
needs: build_release
11+
12+
environment:
13+
name: Deploy
6514

6615
steps:
6716
- uses: actions/checkout@v3
6817

69-
- name: Download individual jars
70-
uses: actions/download-artifact@v3
71-
with:
72-
name: jazzer_tmp
73-
path: _tmp/
74-
75-
- name: Merge jars
76-
run: |
77-
bazel run @rules_jvm_external//private/tools/java/com/github/bazelbuild/rules_jvm_external/jar:MergeJars -- \
78-
--output "$(pwd)"/_tmp/jazzer.jar \
79-
$(find "$(pwd)/_tmp/" -name '*.jar' -printf "--sources %h/%f ")
18+
- name: Docker login
19+
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login --username ${{ secrets.DOCKER_USER }} --password-stdin
8020

81-
- name: Upload merged jar
82-
uses: actions/upload-artifact@v3
83-
with:
84-
name: jazzer
85-
path: _tmp/jazzer.jar
86-
if-no-files-found: error
21+
- name: Push docker containers
22+
run: docker/push_all.sh

deploy/deploy.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ fail() {
2222

2323
cd "$BUILD_WORKSPACE_DIRECTORY" || fail "BUILD_WORKSPACE_DIRECTORY not found"
2424

25+
echo "$RELEASE_SIGNING_KEY_PRIVATE" | gpg --import
26+
echo "default-key $RELEASE_SIGNING_KEY_ID" > $HOME/.gnupg/gpg.conf
27+
2528
JAZZER_COORDINATES=$1
2629

2730
[ -z "${MAVEN_USER+x}" ] && \

0 commit comments

Comments
 (0)