Build IaC - Azure ARM #5
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: 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/setup-bicep@v0.1 | |
- 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 | |
cat IaC/ARM/v1/azuredeploy.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 | |
cat IaC/ARM/v2/azuredeploy.json | |
- name: Commit to Repo | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: main # The branch the action should deploy to. | |
FOLDER: ${{ github.workspace }} # The folder the action should deploy. |