forked from pixie-io/pixie
-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (171 loc) · 6.08 KB
/
cli_release.yaml
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
---
name: cli-release
on:
push:
tags:
- release/cli/**
permissions:
contents: read
env:
VERSIONS_FILE: "VERSIONS.json"
jobs:
get-dev-image:
uses: ./.github/workflows/get_image.yaml
with:
image-base-name: "dev_image_with_extras"
build-release:
name: Build Release
runs-on: ubuntu-latest-16-cores
needs: get-dev-image
container:
image: ${{ needs.get-dev-image.outputs.image-with-tag }}
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
fetch-depth: 0
- name: Add pwd to git safe dir
run: git config --global --add safe.directory `pwd`
- name: get bazel config
uses: ./.github/actions/bazelrc
with:
use_remote_exec: 'true'
BB_API_KEY: ${{ secrets.BB_IO_API_KEY }}
download_toplevel: 'true'
- name: Setup podman
run: |
# With some kernel configs (eg. COS), podman only works with legacy iptables.
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
- name: Get GPG Key from secrets
env:
BUILDBOT_GPG_KEY_B64: ${{ secrets.BUILDBOT_GPG_KEY_B64 }}
run: |
echo "$BUILDBOT_GPG_KEY_B64" | base64 --decode > /tmp/gpg.key
- id: gcloud-creds
uses: ./.github/actions/gcloud_creds
with:
SERVICE_ACCOUNT_KEY: ${{ secrets.GH_RELEASE_SA_PEM_B64 }}
- name: Build & Push Artifacts
env:
REF: ${{ github.event.ref }}
BUILDBOT_GPG_KEY_ID: ${{ secrets.BUILDBOT_GPG_KEY_ID }}
BUILDBOT_GPG_KEY_FILE: "/tmp/gpg.key"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ github.run_attempt }}
JOB_NAME: ${{ github.job }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.gcloud-creds.outputs.gcloud-creds }}
shell: bash
run: |
export TAG_NAME="${REF#*/tags/}"
mkdir -p "artifacts/"
export ARTIFACTS_DIR="$(realpath artifacts/)"
./ci/save_version_info.sh
./ci/cli_build_release.sh
- name: Upload Github Artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: linux-artifacts
path: artifacts/
- name: Update Manifest
env:
ARTIFACT_MANIFEST_BUCKET: "pixie-dev-public"
GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.gcloud-creds.outputs.gcloud-creds }}
run: ./ci/update_artifact_manifest.sh
sign-release:
name: Sign Release for MacOS
runs-on: macos-latest
needs: build-release
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
fetch-depth: 0
- name: Add pwd to git safe dir
run: git config --global --add safe.directory `pwd`
- name: Install gon
run: brew install mitchellh/gon/gon
- name: Sign CLI release
env:
REF: ${{ github.event.ref }}
AC_PASSWD: ${{ secrets.APPLE_ID_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
CERT_BASE64: ${{ secrets.APPLE_SIGN_CERT_B64 }}
CERT_PASSWORD: ${{ secrets.APPLE_SIGN_CERT_PASSWORD }}
shell: bash
run: |
export CERT_PATH="pixie.cert"
echo -n "$CERT_BASE64" | base64 --decode -o "$CERT_PATH"
export TAG_NAME="${REF#*/tags/}"
mkdir -p "artifacts/"
export ARTIFACTS_DIR="$(pwd)/artifacts"
./ci/cli_merge_sign.sh
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: macos-artifacts
path: artifacts/
push-signed-artifacts:
name: Push Signed Artifacts for MacOS
runs-on: ubuntu-latest
needs: [get-dev-image, sign-release]
container:
image: ${{ needs.get-dev-image.outputs.image-with-tag }}
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
fetch-depth: 0
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: macos-artifacts
- name: Get GPG Key from secrets
env:
BUILDBOT_GPG_KEY_B64: ${{ secrets.BUILDBOT_GPG_KEY_B64 }}
run: |
echo "$BUILDBOT_GPG_KEY_B64" | base64 --decode > /tmp/gpg.key
- id: gcloud-creds
uses: ./.github/actions/gcloud_creds
with:
SERVICE_ACCOUNT_KEY: ${{ secrets.GH_RELEASE_SA_PEM_B64 }}
- name: Upload signed CLI
env:
REF: ${{ github.event.ref }}
BUILDBOT_GPG_KEY_ID: ${{ secrets.BUILDBOT_GPG_KEY_ID }}
BUILDBOT_GPG_KEY_FILE: "/tmp/gpg.key"
GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.gcloud-creds.outputs.gcloud-creds }}
shell: bash
run: |
export TAG_NAME="${REF#*/tags/}"
mkdir -p "artifacts/"
export ARTIFACTS_DIR="$(pwd)/artifacts"
./ci/cli_upload_signed.sh
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: macos-artifacts
path: artifacts/
create-github-release:
if: ${{ !contains(github.event.ref, '-') }}
name: Create Release on Github
runs-on: ubuntu-latest
needs: push-signed-artifacts
permissions:
contents: write
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
fetch-depth: 0
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- name: Create Release
env:
REF: ${{ github.event.ref }}
GH_TOKEN: ${{ secrets.BUILDBOT_GH_API_TOKEN }}
OWNER: pixie-io
REPO: pixie
shell: bash
# yamllint disable rule:indentation
run: |
export TAG_NAME="${REF#*/tags/}"
# actions/checkout doesn't get the tag annotation properly.
git fetch origin tag "${TAG_NAME}" -f
export changelog="$(git tag -l --format='%(contents)' "${TAG_NAME}")"
gh release create "${TAG_NAME}" --title "CLI ${TAG_NAME#release/cli/}" \
--notes $'Pixie CLI Release:\n'"${changelog}"
gh release upload "${TAG_NAME}" linux-artifacts/* macos-artifacts/*
# yamllint enable rule:indentation