-
Notifications
You must be signed in to change notification settings - Fork 2
90 lines (78 loc) · 2.51 KB
/
Copy pathimage-deploy.yml
File metadata and controls
90 lines (78 loc) · 2.51 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
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
name: Deploy image
on:
workflow_call:
inputs:
azure_pipeline_id:
description: Deployment pipeline ID
required: true
type: string
deployment_branch:
description: Deployment branch
default: main
type: string
project_name:
description: Project name
required: true
type: string
repository_name:
description: Container repository name
required: true
type: string
tag_name:
description: Image name
required: true
type: string
transformation_environment:
description: For transformation environment
required: true
type: boolean
secrets:
AZURE_CLIENT_ID:
required: true
AZURE_TENANT_ID:
required: true
jobs:
trigger-deploy:
runs-on: ubuntu-latest
defaults:
run:
shell: pwsh
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: |
scripts/workflows
- name: Login to Azure
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
allow-no-subscriptions: true
- name: Get access token for Azure DevOps
run: |
$token = az account get-access-token `
--resource 499b84ac-1321-427f-aa17-267ca6975798 `
--query "accessToken" -o tsv
echo "AZURE_DEVOPS_TOKEN=$token" >> $env:GITHUB_ENV
- name: Deploy image for '${{ inputs.project_name }}'
env:
AZURE_PIPELINE_ID: ${{ inputs.azure_pipeline_id }}
BRANCH: ${{ inputs.deployment_branch }}
PROJECT_NAME: ${{ inputs.project_name }}
REPOSITORY_NAME: ${{ inputs.repository_name }}
TAG_NAME: ${{ inputs.tag_name }}
TRAN: ${{ inputs.transformation_environment }}
run: |
$response = ./scripts/workflows/Start-AzurePipeline `
-Token "$env:AZURE_DEVOPS_TOKEN" `
-ProjectUrl "${{ vars.AZURE_DEVOPS_PROJECT_URL }}" `
-PipelineId "$env:AZURE_PIPELINE_ID" `
-Branch "$env:BRANCH" `
-TemplateParameters @{
projectName = "$env:PROJECT_NAME"
repositoryName = "$env:REPOSITORY_NAME"
tag = "$env:TAG_NAME"
tran = $env:TRAN -eq $true
}
Write-Host "`nLink to pipeline: $($response._links.web.href)"