Skip to content

Commit 77f2360

Browse files
[releases] Create Github release for cloud releases. (#1306)
Summary: TSIA Type of change: /kind cleanup Test Plan: Forced an RC to create a github release, saw that the github release was created properly with the changelog. Signed-off-by: James Bartlett <jamesbartlett@pixielabs.ai>
1 parent a52b009 commit 77f2360

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

.github/workflows/cloud_release.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,40 @@ jobs:
4141
shell: bash
4242
run: |
4343
export TAG_NAME="${REF#*/tags/}"
44+
export ARTIFACTS_DIR="$(pwd)/artifacts"
45+
mkdir -p "${ARTIFACTS_DIR}"
4446
./ci/save_version_info.sh
4547
./ci/cloud_build_release.sh -p
48+
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
49+
with:
50+
name: cloud-artifacts
51+
path: artifacts/
52+
create-github-release:
53+
if: ${{ contains(github.event.ref, '-') }}
54+
name: Create Release on Github
55+
runs-on: ubuntu-latest
56+
needs: build-release
57+
permissions:
58+
contents: write
59+
steps:
60+
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
61+
with:
62+
fetch-depth: 0
63+
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
64+
- name: Create Release
65+
env:
66+
REF: ${{ github.event.ref }}
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
OWNER: pixie-io
69+
REPO: pixie
70+
shell: bash
71+
# yamllint disable rule:indentation
72+
run: |
73+
export TAG_NAME="${REF#*/tags/}"
74+
# actions/checkout doesn't get the tag annotation properly.
75+
git fetch origin tag "${TAG_NAME}" -f
76+
export changelog="$(git tag -l --format='%(contents)' "${TAG_NAME}")"
77+
gh release create "${TAG_NAME}" --title "Cloud ${TAG_NAME#release/cloud/}" \
78+
--notes $'Pixie Cloud Release:\n'"${changelog}"
79+
gh release upload "${TAG_NAME}" cloud-artifacts/*
80+
# yamllint enable rule:indentation

ci/cloud_build_release.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ parse_args() {
3737

3838
parse_args "$@"
3939

40+
artifacts_dir="${ARTIFACTS_DIR:?}"
41+
4042
repo_path=$(pwd)
4143

4244
release_tag=${TAG_NAME##*/v}
@@ -53,7 +55,7 @@ if [[ "$PUBLIC" == "true" ]]; then
5355
bazel run --config=stamp -c opt --action_env=GOOGLE_APPLICATION_CREDENTIALS --//k8s:image_version="${release_tag}" \
5456
--//k8s:build_type=public //k8s/cloud:cloud_images_push
5557

56-
all_licenses_opts=("//tools/licenses:all_licenses" "--action_env=GOOGLE_APPLICATION_CREDENTIALS")
58+
all_licenses_opts=("//tools/licenses:all_licenses" "--action_env=GOOGLE_APPLICATION_CREDENTIALS" "--remote_download_outputs=toplevel")
5759
all_licenses_path="$(bazel cquery "${all_licenses_opts[@]}" --output starlark --starlark:expr "target.files.to_list()[0].path" 2> /dev/null)"
5860
bazel build "${all_licenses_opts[@]}"
5961

@@ -85,6 +87,10 @@ if [[ "$PUBLIC" == "true" ]]; then
8587
gsutil cp "${repo_path}/pixie_cloud.tar.gz" "gs://pixie-dev-public/cloud/latest/pixie_cloud.tar.gz"
8688
fi
8789

90+
sha256sum "${repo_path}/pixie_cloud.tar.gz" | awk '{print $1}' > sha
91+
cp "${repo_path}/pixie_cloud.tar.gz" "${artifacts_dir}/pixie_cloud.tar.gz"
92+
cp sha "${artifacts_dir}/pixie_cloud.tar.gz.sha256"
93+
8894
exit 0
8995
fi
9096

0 commit comments

Comments
 (0)