run bicep #23
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: Deploy Bicep | |
on: | |
push: | |
branches: | |
- main # Change this to match the branch you want to trigger on | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Verify File Existence | |
run: | | |
if [ -f ./main.bicep ]; then | |
echo "File 'main.bicep' exists." | |
else | |
echo "File 'main.bicep' does not exist." | |
exit 1 # Optionally, you can fail the workflow if the file is not found. | |
fi | |
- name: 'Az CLI login' | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: 'Run az commands' | |
run: | | |
az account show | |
az group list | |
- name: Set Working Directory to Repository Root | |
run: cd $GITHUB_WORKSPACE | |
- name: Deplou Bicep | |
uses: azure/arm-deploy@v1 | |
with: | |
scope: subscription | |
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
region: WestEurope | |
template: ./main.bicep | |
# run: az deployment sub create --name GitHubActionsDeployment --location WestEurope --template-file ./main.bicep --parameters location=WestEurope | |
# env: | |
# AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} |