Skip to content

Build Images

Build Images #192

Workflow file for this run

name: Build Images
concurrency: ${{ github.ref }}
on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'images/**'
- 'scripts/**'
# - 'builder/**'
jobs:
build:
# runs-on: windows-latest
runs-on: ubuntu-latest
if: "!contains(join(github.event.commits.*.message), '+nobuild')"
env:
RESOURCE_GROUP_NAME: resourceGroupName
STORAGE_ACCOUNT: experimentdevboxstg12
VNET: vnet
SUBNET_ID:
steps:
- uses: actions/checkout@v2
- name: Login to Azure
run: az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
# az cli installs bicep on demand the first time it's used
# using the --async argument in the command below simultaniously invokes several commands that use bicep
# so if bicep isn't already installed, the all initiate the install which throws a file busy error so we
# execute an arbitrary az bicep command here (and get the latest updates in the process)
- name: Ensure Bicep
run: az bicep upgrade
- name: Deploy
working-directory: ./src_bicep
run: az deployment sub create
--name "GitHub.Actions-first.stage"
--location "westeurope"
--template-file firststage.bicep
--parameters parameters/firststage.bicepparam
- name: Set Subscription to Environment Variable
run: export ID=$(az network vnet subnet list --resource-group ${{ env.RESOURCE_GROUP_NAME }} --vnet-name ${{ env.VNET }} --query "[?name=='default'].id" --output tsv); echo "SUBNET_ID=$ID" >> $GITHUB_ENV
- name: Deploy Build ACI Containers
run: python "./builder/build.py" --async
--repository "${{ github.repositoryUrl }}"
--revision "${{ github.sha }}"
--token "${{ github.token }}"
--client-id "${{ secrets.AZURE_CLIENT_ID }}"
--client-secret "${{ secrets.AZURE_CLIENT_SECRET }}"
--storage-account "${{ env.STORAGE_ACCOUNT }}"
--subnet-id "${{ env.SUBNET_ID }}"