-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (49 loc) · 1.77 KB
/
pr-delete.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
name: Delete PR Helm Charts
on:
workflow_dispatch:
inputs:
branch:
description: 'branch name to delete'
required: true
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: gh-pages
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Extract branch name
shell: bash
run: |
echo "branch=$(echo ${{ github.event.inputs.branch }})" >> $GITHUB_OUTPUT
id: extract_branch
- name: Download YQ
uses: chrisdickinson/[email protected]
with:
yq-version: v4.28.2
- name: Debug step
run: |
echo "Branch: ${{ steps.extract_branch.outputs.branch }}"
echo "Chart version: 0.0.0-${{ steps.extract_branch.outputs.branch }}"
cat pr/index.yaml | yq '.entries.datahub-executor-worker[] | select(.version | test("${{ steps.extract_branch.outputs.branch }}"))'
find pr/ -name '*${{ steps.extract_branch.outputs.branch }}*'
- name: Delete PR Helm charts
run: |
cat pr/index.yaml | yq 'del(.entries.datahub-executor-worker[] | select(.version | test("${{ steps.extract_branch.outputs.branch }}")))' > pr/index.yaml
git status
git ls-files --deleted | xargs git add --all
# Ensure that apiVersion exists
yq -i '.apiVersion = "v1"' pr/index.yaml
git add pr/index.yaml
git status
git commit -m "Deleted all Helm charts from branch: ${{ steps.extract_branch.outputs.branch }}"
git push