Skip to content

Commit 0adc047

Browse files
committed
Added pipeline for main branch
1 parent 4be0030 commit 0adc047

File tree

2 files changed

+157
-0
lines changed

2 files changed

+157
-0
lines changed

.github/workflows/release.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [published]
5+
6+
permissions:
7+
contents: write
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: false
12+
13+
jobs:
14+
default:
15+
uses: cloudposse/example-app/.github/workflows/reusable-release.yml@master
16+
with:
17+
organization: "${{ github.event.repository.owner.login }}"
18+
repository: "${{ github.event.repository.name }}"
19+
registry: registry.hub.docker.com
20+
version: ${{ github.event.release.tag_name }}
21+
secrets:
22+
docker-login: "${{ secrets.DOCKERHUB_USERNAME }}"
23+
docker-password: "${{ secrets.DOCKERHUB_PASSWORD }}"
24+
github-private-actions-pat: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
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

Comments
 (0)