|
5 | 5 | types: |
6 | 6 | - published |
7 | 7 | - edited |
8 | | - workflow_dispatch: {} |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + release_tag: |
| 11 | + description: 'release tag' |
| 12 | + required: true |
9 | 13 |
|
10 | 14 | jobs: |
11 | 15 | release_chart: |
@@ -38,13 +42,21 @@ jobs: |
38 | 42 | - name: Package Chart |
39 | 43 | run: cr package deploy/helm/clickhouse-operator |
40 | 44 |
|
| 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 | +
|
41 | 53 | - name: Get Release Assets |
42 | 54 | id: get_assets |
43 | 55 | run: | |
44 | 56 | CHART_PATH=$(ls .cr-release-packages/altinity-clickhouse-operator-*.tgz) |
45 | 57 | ASSET_NAME=$(basename ${CHART_PATH}) |
46 | 58 | 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" | \ |
48 | 60 | jq -r ".[] | select(.name == \"$ASSET_NAME\") | .id") |
49 | 61 | |
50 | 62 | echo "Asset ID is $ASSET_ID" |
|
54 | 66 | if: steps.get_assets.outputs.asset_id != '' |
55 | 67 | run: | |
56 | 68 | 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 }}" |
58 | 70 |
|
59 | 71 | - name: Upload Release Artifacts |
60 | 72 | run: | |
|
64 | 76 | -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ |
65 | 77 | -H "Content-Type: application/gzip" \ |
66 | 78 | -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})" |
68 | 80 | - name: Validate Helm Repository Configuration |
69 | 81 | run: | |
70 | 82 | if [ -z "${{ secrets.HELM_GITHUB_TOKEN }}" ]; then |
|
0 commit comments