Skip to content

Commit

Permalink
Merge pull request #9 from XPRTZ/feature/setup-pipelines
Browse files Browse the repository at this point in the history
Updating pipeline setup
Physer authored Jun 14, 2024
2 parents 18853c6 + 554238b commit abb48a6
Showing 2 changed files with 53 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
name: Infrastructure workflow
name: Deploy infrastructure

on:
workflow_dispatch:
pull_request:
branches: [ main ]
push:
branches: [ main ]
branches: [main]

permissions:
id-token: write
contents: read
id-token: write
contents: read

jobs:
Deploy:
deploy-infrastructure:
name: Deploy infrastructure
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@main
- uses: actions/checkout@v4

- name: Azure login
uses: azure/login@v1
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Show subscription details
uses: azure/CLI@v1
with:
azcliversion: latest
inlineScript: |
az account show
- name: Deploy infrastructure
uses: azure/arm-deploy@v1
uses: azure/arm-deploy@v2
with:
scope: subscription
region: westeurope
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
template: ./main.bicep
failOnStdErr: false

43 changes: 43 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Pull request
run-name: Pull request build for ${{ github.head_ref }}

on:
workflow_dispatch:
pull_request:
branches: [main]

permissions:
id-token: write
contents: read

env:
BICEP_FILE: ./main.bicep

jobs:
verify-bicep-files:
name: Validate Bicep files
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4

- name: Azure login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Build Bicep files
uses: Azure/cli@v2
with:
inlineScript: az bicep build --file ${{ env.BICEP_FILE }}

- name: Validate Bicep deployment on subscription level
uses: Azure/cli@v2
with:
inlineScript: |
az deployment sub validate \
--name validate-${{ github.run_id }} \
--template-file ${{ env.BICEP_FILE }} \
--location westeurope

0 comments on commit abb48a6

Please sign in to comment.