Added - Release for v6.15.0 #124
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: Generate magic buttons for examples and publish | |
on: | |
push: | |
branches: [ release_gh ] | |
paths: ['examples/**/**'] | |
jobs: | |
publish_examples_magic_buttons: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Create description files | |
run: | | |
FOLDERS=$(ls -d examples/*/ | jq -R) | |
for EXAMPLE_FOLDER in $FOLDERS; | |
do | |
RESOURCE=$(cut -d "/" -f 2 <<< "$EXAMPLE_FOLDER") | |
FILENAME=description.md | |
if [[ "$RESOURCE" != "zips" ]]; then | |
if [ -f "./examples/$RESOURCE/$FILENAME" ]; then | |
echo "./examples/$RESOURCE/$FILENAME exists." | |
else | |
printf '# Overview \nThis is a Terraform configuration that creates the `'${RESOURCE}'` service on Oracle Cloud Infrastructure. \n\nThe Terraform code is used to create a Resource Manager stack, that creates the required resources and configures the application on the created resources.' > ./examples/${RESOURCE}/${FILENAME} | |
echo "./examples/$RESOURCE/$FILENAME created." | |
fi | |
fi | |
done | |
- name: Commit and Push Changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git config --global user.name "tf-oci-pub" | |
git config --global user.email "[email protected]" | |
git pull origin release_gh | |
git add ./examples/* | |
git commit -m "Added - Description files for service examples" | |
git push | |
else | |
echo "No changes!"; | |
fi | |
- name: Create README files | |
run: | | |
if [ -d "./examples/zips" ]; then | |
rm -r examples/zips | |
fi | |
mkdir -p examples/zips | |
printf '## Terraform Oracle Cloud Infrastructure Provider Examples \n### Examples In This Directory \nThis directory contains Terraform configuration files showing how to create specific resources. The examples are intended to be as simple as possible, in most cases containing only the specific resource and any dependencies required for it to run. These do not represent production configurations or real world scenarios. The magic buttons of the examples can be found below.\n' > ./examples/${RESOURCE}/README.md | |
FOLDERS=$(ls -d examples/*/ | jq -R) | |
MAGIC_LINK="https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/raw/master/examples/zips/" | |
for EXAMPLE_FOLDER in $FOLDERS; | |
do | |
RESOURCE=$(cut -d "/" -f 2 <<< "$EXAMPLE_FOLDER") | |
if [[ "$RESOURCE" != "zips" ]]; then | |
FILENAME=description.md | |
FILEZIP=${RESOURCE}.zip | |
FOLDER=$(echo "$EXAMPLE_FOLDER" | tr -d '"') | |
zip -r $FILEZIP $FOLDER || { printf '\n Unable to create zips.\n'; exit 1; } | |
mv $FILEZIP ./examples/zips | |
cat ./examples/${RESOURCE}/$FILENAME > ./examples/${RESOURCE}/README.md | |
printf '\n## Magic Button \n[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)]('${MAGIC_LINK}${FILEZIP}')' >>./examples/${RESOURCE}/README.md | |
printf '%s\n' '- '${RESOURCE}' | |
[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)]('${MAGIC_LINK}${FILEZIP}')' >> ./examples/README.md | |
fi | |
done | |
- name: Commit and Push Changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git config --global user.name "tf-oci-pub" | |
git config --global user.email "[email protected]" | |
git pull origin release_gh | |
git add ./examples/* | |
git commit -m "Added - README.md of service examples with magic button" | |
git push | |
else | |
echo "No changes!"; | |
fi |