forked from microsoft/AL-Go
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (56 loc) · 2.21 KB
/
Deploy.yaml
File metadata and controls
61 lines (56 loc) · 2.21 KB
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
name: Deploy
on:
workflow_dispatch:
inputs:
branch:
description: Branch to deploy to (default is main) - (NOTE Use preview when deploying preview releases on microsoft/al-go)
required: false
default: 'main'
copyToMain:
description: Additionally deploy templates to main+preview branch? (Y/N) - (NOTE Only use Yes when deploying ordinary releases on microsoft/al-go)
required: false
default: 'N'
defaults:
run:
shell: PowerShell
jobs:
Deploy:
runs-on: [ windows-latest ]
steps:
- uses: actions/checkout@v2
- name: CheckUser
run: |
if ("$ENV:GITHUB_REPOSITORY" -eq "microsoft/AL-Go" -and "$ENV:GITHUB_ACTOR" -ne "freddydk") {
Write-Host "::Error::You cannot run deploy and collect in the microsoft/AL-Go repo"
exit 1
}
- name: Deploy
run: |
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2.0
try {
$token = '${{ Secrets.OrgPAT }}'
if (!$token) {
throw "In order to run the Deploy workflow, you need a Secret called OrgPAT containing a valid Personal Access Token"
}
else {
$githubOwner = "$ENV:GITHUB_REPOSITORY_OWNER"
$settings = [ordered]@{
"githubOwner" = $githubOwner
"actionsRepo" = "AL-Go-Actions"
"perTenantExtensionRepo" = "AL-Go-PTE"
"appSourceAppRepo" = "AL-Go-AppSource"
"branch" = '${{ github.event.inputs.branch }}'
"copyToMain" = ('${{ github.event.inputs.copyToMain }}' -eq 'Y')
"localFolder" = ""
"baseFolder" = [System.IO.Path]::GetTempPath()
}
$settingsFile = Join-Path $settings.baseFolder "deploy.json"
$settings | ConvertTo-Json | Set-Content $settingsFile -Encoding UTF8
. ".\Internal\Deploy.ps1" -configName $settingsFile -githubOwner $githubOwner -token $token -github
}
}
catch {
Write-Host "::Error::Error deploying repositories. The error was $($_.Exception.Message)"
exit 1
}