1+ name : Reusable - Release
2+ on :
3+ workflow_call :
4+ inputs :
5+ organization :
6+ required : true
7+ type : string
8+ repository :
9+ required : true
10+ type : string
11+ registry :
12+ description : " Docker registry"
13+ required : false
14+ type : string
15+ default : registry.hub.docker.com
16+ version :
17+ required : true
18+ type : string
19+ secrets :
20+ docker-login :
21+ required : true
22+ docker-password :
23+ required : true
24+ github-private-actions-pat :
25+ required : true
26+
27+ permissions :
28+ contents : write
29+
30+ jobs :
31+ promote :
32+ runs-on : ["self-hosted"]
33+ permissions :
34+ contents : write
35+ steps :
36+ - name : Checkout
37+ uses : actions/checkout@v3
38+
39+ - name : Promote Docker image
40+ uses :
EuphoricSystems/[email protected] 41+ with :
42+ src : ${{ inputs.registry }}/${{ inputs.organization }}/${{ inputs.repository }}:sha-${{ github.sha }}
43+ destinations : ${{ inputs.registry }}/${{ inputs.organization }}/${{ inputs.repository }}:${{ github.event.release.tag_name }}
44+
45+ outputs :
46+ image : ${{ inputs.registry }}/${{ inputs.organization }}/${{ inputs.repository }}
47+ tag : ${{ github.event.release.tag_name }}
48+
49+ deploy_staging :
50+ runs-on : ["self-hosted"]
51+ environment :
52+ name : staging
53+ url : ${{ steps.deploy.outputs.webapp-url }}
54+ needs : [ promote ]
55+ steps :
56+ - name : Checkout
57+ uses : actions/checkout@v3
58+
59+ - name : Checkout Private actions
60+ uses : actions/checkout@v3
61+ with :
62+ repository : cloudposse/actions-private
63+ ref : main
64+ token : ${{ secrets.github-private-actions-pat }}
65+ path : .github/actions
66+
67+ - name : Environment Info
68+ uses : ./.github/actions/environments
69+ id : environment
70+ with :
71+ environment : staging
72+ namespace : staging
73+
74+ - name : Deploy
75+ id : deploy
76+ uses : ./.github/actions/deploy
77+ with :
78+ aws-region : ${{ steps.environment.outputs.region }}
79+ base-role : ${{ steps.environment.outputs.role }}
80+ cluster : ${{ steps.environment.outputs.cluster }}
81+ cluster-role : ${{ steps.environment.outputs.cluster-role }}
82+ environment : ${{ steps.environment.outputs.name }}
83+ namespace : ${{ steps.environment.outputs.namespace }}
84+ image : ${{ needs.promote.outputs.image }}
85+ image-tag : ${{ needs.promote.outputs.tag }}
86+ operation : deploy
87+ env :
88+ ISTIO_INSTALLED : false
89+ COLOR : green
90+ RELEASE_NAME : example-app-green
91+
92+ deploy_production :
93+ runs-on : ["self-hosted"]
94+ environment :
95+ name : production
96+ url : ${{ steps.deploy.outputs.webapp-url }}
97+ needs : [ promote, deploy_staging ]
98+ steps :
99+ - name : Checkout
100+ uses : actions/checkout@v3
101+
102+ - name : Checkout Private actions
103+ uses : actions/checkout@v3
104+ with :
105+ repository : cloudposse/actions-private
106+ ref : main
107+ token : ${{ secrets.github-private-actions-pat }}
108+ path : .github/actions
109+
110+ - name : Environment Info
111+ uses : ./.github/actions/environments
112+ id : environment
113+ with :
114+ environment : production
115+ namespace : production
116+
117+ - name : Deploy
118+ id : deploy
119+ uses : ./.github/actions/deploy
120+ with :
121+ aws-region : ${{ steps.environment.outputs.region }}
122+ base-role : ${{ steps.environment.outputs.role }}
123+ cluster : ${{ steps.environment.outputs.cluster }}
124+ cluster-role : ${{ steps.environment.outputs.cluster-role }}
125+ environment : ${{ steps.environment.outputs.name }}
126+ namespace : ${{ steps.environment.outputs.namespace }}
127+ image : ${{ needs.promote.outputs.image }}
128+ image-tag : ${{ needs.promote.outputs.tag }}
129+ operation : deploy
130+ env :
131+ ISTIO_INSTALLED : false
132+ COLOR : green
133+ RELEASE_NAME : example-app-green
0 commit comments