Skip to content

Fix merging issue with parent & child workspaces #74

Fix merging issue with parent & child workspaces

Fix merging issue with parent & child workspaces #74

# Publish Pipelines generated when project is tagged
name: Publish Pipelines generated
on:
workflow_dispatch:
push:
branches:
- main
jobs:
generate:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- name: Build with Maven
run: mvn -B clean package
- name: Run the builder application over the existing configurations
run: |
# Cleanup the generated folder
rm -rf generated/**/*
cfg_files=(configurations/**/*)
for f in "${cfg_files[@]}"
do
java -jar target/quarkus-app/quarkus-run.jar -o generated -c $f
done
# NOT USED ANYMORE
# Sometimes the python script happens ``` end of the last YAML line and remove the next README CR
#
#- name: Markdown Code Embed
# continue-on-error: true
# #if: steps.changed-files-yaml.outputs.doc_any_changed == 'true'
# run: |
# #!/usr/bin/env bash
# set -e
#
# git clone https://github.com/ippie52/markdown_code_embed.git
#
# python markdown_code_embed/mdce.py -f README.md
# NOT USED
#- name: Get doc files that have changed
# id: changed-files-yaml
# uses: tj-actions/changed-files@v44
# with:
# files_yaml: |
# doc:
# - '**.md'
- name: Generate the content of the SCENARIO.md file
run: |
cfg_files=(configurations/**/*)
CMD="java -jar target/quarkus-app/quarkus-run.jar"
printf '%s\n\n' "# Scenario" > SCENARIO.md
for f in "${cfg_files[@]}"
do
type=$(cat "$f" | yq -r ".type")
domain=$(cat "$f" | yq -r ".domain")
title=$(cat "$f" | yq -r ".job.description")
fileName=$(cat "$f" | yq -r ".job.name")
resourceType=$(cat "$f" | yq -r ".job.resourceType")
printf '%s\n\n' "## Provider: $type" >> SCENARIO.md
printf '%s\n\n' "### $title" >> SCENARIO.md
printf '%s\n' "Command to be executed: " >> SCENARIO.md
printf '%s\n' "\`\`\`bash" >> SCENARIO.md
printf '%s\n' "$CMD -o out/flows -c $f" >> SCENARIO.md
printf '%s\n' "\`\`\`" >> SCENARIO.md
printf '%s\n' "using as configuration: " >> SCENARIO.md
printf '%s\n' "\`\`\`yaml" >> SCENARIO.md
printf '%s\n' "# $f" >> SCENARIO.md
printf '%s\n' "\`\`\`" >> SCENARIO.md
printf '%s\n' "Generated file: " >> SCENARIO.md
printf '%s\n' "\`\`\`yaml" >> SCENARIO.md
generate_path="generated/$type/$domain/$(echo $resourceType | awk '{print tolower($0)}')-$fileName.yaml"
printf '%s\n' "# $generate_path" >> SCENARIO.md
printf '%s\n' "\`\`\`" >> SCENARIO.md
done
cat SCENARIO.md
- name: Embed snippet code within the SCENARIO.md file
run: |
npx embedme SCENARIO.md
- name: Get current date
id: date
#if: steps.changed-files-yaml.outputs.doc_any_changed == 'true'
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Create pull request for the updated SCENARIO.md file
#if: steps.changed-files-yaml.outputs.doc_any_changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: new-generated-pipelines-${{ env.CURRENT_DATE }}
title: "New resources generated and SCENARIO.md file updated - ${{ env.CURRENT_DATE }}"
labels: |
documentation
body: |
Pull request for New resources generated and SCENARIO.md changed.