forked from codefresh-contrib/gitops-cert-level-2-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (61 loc) · 1.96 KB
/
promote.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
# Promote a GitOps application from one environment to the next
name: Promote application
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
source_env:
description: 'Source environment'
required: true
default: 'qa'
type: choice
options:
- qa
- staging
- prod
target_env:
description: 'Target environment'
required: true
default: 'staging'
type: choice
options:
- qa
- staging
- prod
promote_container:
description: 'Promote container tag'
required: true
type: boolean
default: 'true'
promote_configmaps:
description: 'Also promote application settings'
required: true
type: boolean
messsage:
description: 'Commit message'
required: true
type: string
default: 'Application promotion'
jobs:
promote:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Copy container tag
if: ${{ inputs.promote_container }}
uses: canastro/copy-file-action@master
with:
source: "environment-promotion/envs/${{ inputs.source_env }}/version.yml"
target: "environment-promotion/envs/${{ inputs.target_env }}/version.yml"
- name: Copy settings
if: ${{ inputs.promote_configmaps }}
uses: canastro/copy-file-action@master
with:
source: "environment-promotion/envs/${{ inputs.source_env }}/settings.yml"
target: "environment-promotion/envs/${{ inputs.target_env }}/settings.yml"
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: ${{ inputs.messsage }}