Skip to content

Create Release Branch #25

Create Release Branch

Create Release Branch #25

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@v4.2.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@v4
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@v4
with:
ref: main
- name: Download the required-plugins artifact
uses: actions/download-artifact@v4
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