Skip to content

Commit c6c9764

Browse files
[releases] Create Github release for operator releases (#1301)
Summary: Adds a github release for each operator non-RC release. Type of change: /kind cleanup Test Plan: Tested by forcing an RC to create a github release: https://github.com/pixie-io/pixie/releases/tag/release%2Foperator%2Fv0.1.1-pre-z4-1-test-operator-release.4 Signed-off-by: James Bartlett <jamesbartlett@pixielabs.ai>
1 parent ec38b21 commit c6c9764

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

.github/workflows/operator_release.yaml

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

ci/operator_helm_build_release.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ parse_args() {
3333

3434
parse_args "$@"
3535
tmp_dir="$(mktemp -d)"
36+
artifacts_dir="${ARTIFACTS_DIR:?}"
3637

3738
helm_gcs_bucket="pixie-operator-charts"
3839
if [[ $VERSION == *"-"* ]]; then
@@ -81,5 +82,9 @@ helm package "${helm_path}2" -d "${tmp_dir}/${helm_gcs_bucket}"
8182
# Update the index file.
8283
helm repo index "${tmp_dir}/${helm_gcs_bucket}" --url "https://${helm_gcs_bucket}.storage.googleapis.com"
8384

85+
cp "${tmp_dir}/${helm_gcs_bucket}/pixie-operator-chart-${VERSION}.tgz" "${artifacts_dir}/pixie-operator-chart-${VERSION}.tgz"
86+
sha256sum "${tmp_dir}/${helm_gcs_bucket}/pixie-operator-chart-${VERSION}.tgz" | awk '{print $1}' > sha
87+
cp sha "${artifacts_dir}/pixie-operator-chart-${VERSION}.tgz.sha256"
88+
8489
# Upload the new index and tar to gcs by syncing. This will help keep the timestamps for pre-existing tars the same.
8590
gsutil rsync "${tmp_dir}/${helm_gcs_bucket}" "gs://${helm_gcs_bucket}"

0 commit comments

Comments
 (0)