Skip to content

Commit 380656d

Browse files
committed
1 parent 8631cc5 commit 380656d

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.github/workflows/release_chart.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ on:
55
types:
66
- published
77
- edited
8-
workflow_dispatch: {}
8+
workflow_dispatch:
9+
inputs:
10+
release_tag:
11+
description: 'release tag'
12+
required: true
913

1014
jobs:
1115
release_chart:
@@ -38,13 +42,21 @@ jobs:
3842
- name: Package Chart
3943
run: cr package deploy/helm/clickhouse-operator
4044

45+
- name: Resolve release ID
46+
run: |
47+
RELEASE_ID="${{ github.event.release.id }}"
48+
if [[ -z "RELEASE_ID" ]]; then
49+
RELEASE_ID=$(curl -s -H "Accept: application/json" https://github.com/${{ github.repository }}/releases/${{ github.event.inputs.release_tag }} | jq .id)
50+
fi
51+
echo "RELEASE_ID=$RELEASE_ID" >> "$GITHUB_ENV"
52+
4153
- name: Get Release Assets
4254
id: get_assets
4355
run: |
4456
CHART_PATH=$(ls .cr-release-packages/altinity-clickhouse-operator-*.tgz)
4557
ASSET_NAME=$(basename ${CHART_PATH})
4658
ASSET_ID=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
47-
"https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets" | \
59+
"https://api.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets" | \
4860
jq -r ".[] | select(.name == \"$ASSET_NAME\") | .id")
4961
5062
echo "Asset ID is $ASSET_ID"
@@ -54,7 +66,7 @@ jobs:
5466
if: steps.get_assets.outputs.asset_id != ''
5567
run: |
5668
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
57-
"https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets/${{ steps.get_assets.outputs.asset_id }}"
69+
"https://api.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets/${{ steps.get_assets.outputs.asset_id }}"
5870
5971
- name: Upload Release Artifacts
6072
run: |
@@ -64,7 +76,7 @@ jobs:
6476
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
6577
-H "Content-Type: application/gzip" \
6678
-T "${CHART_PATH}" \
67-
"https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ github.event.release.id }}/assets?name=$(basename ${CHART_PATH})"
79+
"https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename ${CHART_PATH})"
6880
- name: Validate Helm Repository Configuration
6981
run: |
7082
if [ -z "${{ secrets.HELM_GITHUB_TOKEN }}" ]; then

0 commit comments

Comments
 (0)