Skip to content

IaC: Add Storage Container named 'docs' to all templates #11

IaC: Add Storage Container named 'docs' to all templates

IaC: Add Storage Container named 'docs' to all templates #11

name: Build IaC - Azure ARM
on:
push:
branches: [ main ]
paths:
- 'IaC/Bicep/**'
workflow_dispatch:
jobs:
build-arm-templates:
name: 'Build ARM Templates'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bicep
uses: anthony-c-martin/[email protected]
- name: Ensure ARM v1 Folder Exists
run: |
if [ ! -d "IaC/ARM" ]; then
mkdir "IaC/ARM"
fi
if [ ! -d "IaC/ARM/v1" ]; then
mkdir "IaC/ARM/v1"
fi
- name: Build ARM v1
run: |
bicep build deploy.bicep
working-directory: IaC/Bicep/v1
- name: Move ARM v1
run: |
rm IaC/ARM/v1/azuredeploy.json
cp -rf IaC/Bicep/v1/deploy.json IaC/ARM/v1/azuredeploy.json
rm IaC/Bicep/v1/deploy.json
- name: Ensure ARM v2 Folder Exists
run: |
if [ ! -d "IaC/ARM" ]; then
mkdir "IaC/ARM"
fi
if [ ! -d "IaC/ARM/v2" ]; then
mkdir "IaC/ARM/v2"
fi
- name: Build ARM v2
run: |
bicep build deploy.bicep
working-directory: IaC/Bicep/v2
- name: Move ARM v2
run: |
rm IaC/ARM/v2/azuredeploy.json
cp -rf IaC/Bicep/v2/deploy.json IaC/ARM/v2/azuredeploy.json
rm IaC/Bicep/v2/deploy.json
- name: Check for Changes
id: check_changes
run: |
if [[ -n "$(git diff --exit-code)" ]]; then
echo "Changes detected."
echo "::set-output name=has_changes::true"
else
echo "No changes detected."
echo "::set-output name=has_changes::false"
fi
- name: Commit and Push Changes
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git config --global user.email "${{ github.actor }}"
git config --global user.name "${{ github.actor }}@users.noreply.github.com"
git add IaC/ARM/v1/azuredeploy.json
git add IaC/ARM/v2/azuredeploy.json
git commit -m 'rebuilding ARM templates from Bicep'
git push