-
Notifications
You must be signed in to change notification settings - Fork 141
72 lines (69 loc) · 2.57 KB
/
prepare-chart-release-candidate.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
name: "Chart - Prepare - Release - Candidate"
on:
workflow_dispatch:
inputs:
releaseCandidateBranchName:
description: "Branch Name of The Release Candidate"
required: false
default: "release-candidate"
pull_request:
permissions:
contents: write
pull-requests: write
jobs:
clean:
name: Clean RC artifacts
permissions:
packages: write
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: /tmp
steps:
- name: Delete old artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get IDs of the artifacts that include "rc" (the sha256 digest).
artifacts_ids_to_delete="$(
gh api -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' \
'/orgs/camunda/packages/container/helm%2Fcamunda-platform/versions?per_page=100' | \
jq '.[] | select(.metadata.container.tags[] | contains("rc")) | .id'
)"
# Early exit if no artifacts to delete.
test -z "${artifacts_ids_to_delete}" && {
echo "No RC artifacts to delete ...";
exit 0;
}
# Delete the RC artifacts.
# echo -e "Deleting the old untagged artifacts IDs:\n${artifacts_ids_to_delete}"
# for container_id in ${artifacts_ids_to_delete}; do
# gh api --method DELETE -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
# "/orgs/camunda/packages/container/helm%2Fcamunda-platform/versions/${container_id}"
# done
#testing to see if the reset job will run
exit 1
reset:
needs: [clean]
name: reset release-candidate branch
runs-on: ubuntu-latest
steps:
- name: Generate GitHub token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2
id: generate-github-token
with:
app_id: ${{ secrets.GH_APP_ID_DISTRO_CI }}
private_key: ${{ secrets.GH_APP_PRIVATE_KEY_DISTRO_CI }}
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
ref: ${{ github.event.inputs.releaseCandidateBranchName }}
fetch-depth: 0
token: "${{ steps.generate-github-token.outputs.token }}"
# - name: Reset release-candidate branch to master
# env:
# RC_BRANCH: ${{ github.event.inputs.releaseCandidateBranchName }}
# run: |
# git checkout ${{ env.RC_BRANCH }}
# git reset origin/main --hard