-
Notifications
You must be signed in to change notification settings - Fork 55
140 lines (115 loc) · 4.14 KB
/
create-release-branch.yaml
File metadata and controls
140 lines (115 loc) · 4.14 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Create Release Branch
on:
workflow_dispatch:
inputs:
release-branch:
description: Name of the release branch that should be created (release-x.x)
required: true
type: string
debug:
description: Debug the shell scripts
type: boolean
required: false
default: false
concurrency:
group: ${{ github.workflow_ref }}
cancel-in-progress: true
jobs:
prepare-required-plugins:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Create the required-plugins file@
continue-on-error: true
run: |
cat rhdh-community-packages.txt rhdh-techpreview-packages.txt rhdh-supported-packages.txt > required-plugins
- name: Upload required-plugins file
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: required-plugins
path: required-plugins
check:
needs:
- prepare-required-plugins
uses: redhat-developer/rhdh-plugin-export-utils/.github/workflows/check-backstage-compatibility.yaml@main
with:
overlay-branch: main
debug: ${{ inputs.debug || false }}
fail-for-required-only: true
create:
needs:
- check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: main
- name: Download the required-plugins artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
continue-on-error: true
with:
name: required-plugins
- name: Update badge Json on the metadata branch.
env:
INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES: ${{ needs.check.outputs.incompatible-unrequired-workspaces }}
INPUT_RELEASE_BRANCH: ${{ inputs.release-branch }}
run: |
if [[ "${{ inputs.debug }}" == "true" ]]
then
set -x
fi
git config user.name "GitHub Actions Bot"
git config user.email "github-actions[bot]@users.noreply.github.com"
git switch -c "${INPUT_RELEASE_BRANCH}"
IFS=$'\n'
for incompatible in ${INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES}
do
echo ::notice ::Removing incompatible workspace: ${incompatible}
rm -rfv ${incompatible}
done
missingPlugins=false
while IFS= read -r line; do
echo "Checking required plugin: ${line}"
workspacePath="workspaces/$(echo ${line} | cut -d'/' -f1)"
pluginPath="$(echo ${line} | cut -d'/' -f2-)"
if [[ ! -d "${workspacePath}" ]]
then
echo ::error ::Required workspace ${workspacePath} is missing.
missingPlugins=true
continue
fi
if ! grep -q "${pluginPath}:" "${workspacePath}/plugins-list.yaml"
then
echo ::error ::Required plugin ${pluginPath} is not in ${workspacePath}/plugins-list.yaml!
missingPlugins=true
continue
fi
done < <(grep -E -v '^ *#|^ *$' required-plugins | sort -u)
if [[ "${missingPlugins}" == "true" ]]
then
exit 1
fi
if ! git diff --quiet
then
git commit -a -m "Remove incompatible workspaces when creating branch ${INPUT_RELEASE_BRANCH}."
fi
git push origin "${INPUT_RELEASE_BRANCH}"
permissions:
contents: write
export:
uses: redhat-developer/rhdh-plugin-export-utils/.github/workflows/export-workspaces-as-dynamic.yaml@main
needs:
- create
with:
publish-container: true
image-repository-prefix: ${{ format('ghcr.io/{0}', github.repository) }}
overlay-branch: ${{ inputs.release-branch }}
image-registry-user: ${{ github.actor }}
secrets:
image-registry-password: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
attestations: write
packages: write
id-token: write