Add tech-insights
workspace
#38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Export Dynamic Plugin Packages | |
on: | |
workflow_dispatch: | |
inputs: | |
node-version: | |
description: node-version to execute the export | |
required: false | |
type: choice | |
default: '20.x' | |
options: | |
- '18.x' | |
- '20.x' | |
upload-project-on-error: | |
description: Upload the complete project as a workflow artifact in case of error in order to troubleshoot. | |
required: false | |
type: boolean | |
default: false | |
workspace-path: | |
description: Relative path of a single workspace on which the export workflow should be applied. | |
required: false | |
type: string | |
push: | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: | |
- 'releases/**' | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
name: Prepare | |
outputs: | |
node-version: ${{ steps.set-env-vars.outputs.NODE_VERSION }} | |
workspaces: ${{ steps.gather-workspaces.outputs.workspaces }} | |
upload-project-on-error: ${{ steps.set-env-vars.outputs.UPLOAD_PROJECT_ON_ERROR }} | |
steps: | |
- name: Set environment variables | |
id: set-env-vars | |
shell: bash | |
run: | | |
if [[ "${{ github.event.inputs.node-version }}" != "" ]] | |
then | |
echo "NODE_VERSION=${{ github.event.inputs.node-version }}" >> $GITHUB_OUTPUT | |
echo "UPLOAD_PROJECT_ON_ERROR='${{ github.event.inputs.upload-project-on-error }}'" >> $GITHUB_OUTPUT | |
else | |
echo "NODE_VERSION=20.x" >> $GITHUB_OUTPUT | |
echo "UPLOAD_PROJECT_ON_ERROR='false'" >> $GITHUB_OUTPUT | |
fi | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Gather workspaces | |
id: gather-workspaces | |
shell: bash | |
run: | | |
workspacePath='' | |
if [[ "${{ github.event.inputs.workspace-path }}" != "" ]] | |
then | |
workspacePath="${{ github.event.inputs.workspace-path }}" | |
elif [[ "${{ github.event_name }}" == 'pull_request' ]] && [[ "${{ github.head_ref }}" == "workspaces/"* ]] | |
then | |
workspacePath="$(echo '${{ github.head_ref }}' | sed -e 's:workspaces/[^_]*__\(.*\)$:workspaces/\1:')" | |
fi | |
json=$( | |
echo -n '[' | |
for d in $(find workspaces -mindepth 1 -type d) | |
do | |
if [[ "${workspacePath}" != "" ]] && [[ "${workspacePath}" != "$d" ]] | |
then | |
continue | |
fi | |
if [[ -f "${d}/plugins-list.yaml" ]] && [[ -f "${d}/plugins-repo-ref" ]] | |
then | |
echo -n "${comma} {\"plugins-root\": \"${d}\", \"plugins-repo-ref\": \"$(cat ${d}/plugins-repo-ref)\"}" | |
comma=',' | |
fi | |
done | |
echo -n ']' | |
) | |
echo "Workspaces to export:" | |
echo "$json" | |
echo "workspaces=${json}" >> $GITHUB_OUTPUT | |
export: | |
needs: prepare | |
uses: redhat-developer/rhdh-plugin-export-utils/.github/workflows/export-dynamic.yaml@main | |
strategy: | |
fail-fast: false | |
matrix: | |
workspace: ${{ fromJSON(needs.prepare.outputs.workspaces) }} | |
with: | |
plugins-repo: backstage/community-plugins | |
plugins-repo-ref: ${{ matrix.workspace.plugins-repo-ref }} | |
plugins-root: ${{ matrix.workspace.plugins-root }} | |
overlay-repo: ${{ github.repository }} | |
overlay-repo-ref: ${{ github.ref_name }} | |
node-version: ${{ needs.prepare.outputs.node-version }} | |
upload-project-on-error: ${{ needs.prepare.outputs.upload-project-on-error == 'true' }} | |
permissions: | |
contents: write |