forked from Azure/dev-box-images
-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (48 loc) · 2.11 KB
/
build_images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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 }}"