-
Notifications
You must be signed in to change notification settings - Fork 3
103 lines (94 loc) · 3.13 KB
/
release.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Deploy Actions Runner
on:
push:
branches:
- main
paths:
- infrastructure/aci/**
workflow_dispatch:
inputs:
deployLinuxRunner:
description: 'Deploy Linux Runner'
type: boolean
required: true
default: true
deployWindowsRunner:
description: 'Deploy Windows Runner'
type: boolean
required: true
default: true
env:
ACI_ROOT: ${{ github.workspace }}/src/infrastructure/aci
AZURE_LOCATION: australiaeast
AZURE_RG: ${{ vars.ENV_AZURE_RG }}
ACR_NAME: ${{ vars.ENV_ACR_NAME }}
ACR_SERVER: ${{ vars.ENV_ACR_NAME }}.azurecr.io
SUBNET_ID: ${{ vars.ENV_SUBNET_ID }}
DNS_SERVERS: ${{ vars.ENV_DNS_SERVERS }}
LNX_ACI_NAME: ${{ vars.ENV_LNX_ACI_NAME }}
WIN_ACI_NAME: ${{ vars.ENV_WIN_ACI_NAME }}
LNX_IMAGE_NAME: github-runners/github-runner-linux-amd64:latest
WIN_IMAGE_NAME: github-runners/github-runner-win-amd64:latest
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.ENV_AZURE_CREDENTIALS }}
- name: Run PSRule
uses: ./.github/actions/ps-rule
with:
TEMPLATE_NAME: ACI
INPUT_PATH: ${{ env.ACI_ROOT }}/.test
deployLinux:
name: Deploy Linux Runner
runs-on: ubuntu-latest
needs: validate
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' || inputs.deployLinuxRunner }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Deploy ACI
uses: ./.github/actions/github-runner-deploy
with:
AZURE_CREDENTIALS: ${{ secrets.ENV_AZURE_CREDENTIALS }}
ROOT: ${{ env.ACI_ROOT }}
AZURE_RG: ${{ env.AZURE_RG }}
ACR_NAME: ${{ env.ACR_NAME }}
ACI_NAME: ${{ env.LNX_ACI_NAME }}
IMAGE_NAME: ${{ env.LNX_IMAGE_NAME }}
GITHUB_TOKEN: ${{ secrets.ENV_GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
ACR_SERVER: ${{ env.ACR_SERVER }}
SUBNET_ID: ${{ env.SUBNET_ID }}
DNS_SERVERS: ${{ env.DNS_SERVERS }}
OS: Linux
deployWindows:
name: Deploy Windows Runner
runs-on: ubuntu-latest
needs: validate
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' || inputs.deployWindowsRunner }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Deploy ACI
uses: ./.github/actions/github-runner-deploy
with:
AZURE_CREDENTIALS: ${{ secrets.ENV_AZURE_CREDENTIALS }}
ROOT: ${{ env.ACI_ROOT }}
AZURE_RG: ${{ env.AZURE_RG }}
ACR_NAME: ${{ env.ACR_NAME }}
ACI_NAME: ${{ env.WIN_ACI_NAME }}
IMAGE_NAME: ${{ env.WIN_IMAGE_NAME }}
GITHUB_TOKEN: ${{ secrets.ENV_GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
ACR_SERVER: ${{ env.ACR_SERVER }}
SUBNET_ID: ${{ env.SUBNET_ID }}
DNS_SERVERS: ${{ env.DNS_SERVERS }}
OS: Windows
INSTANCES_COUNT: 1