-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (96 loc) · 3.25 KB
/
ci.yaml
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: SPAship puzzle build and push into container repository
on:
push:
branches:
- '*'
tags:
- '*'
workflow_dispatch:
inputs:
env:
description: Select environment
options:
- Dev
- Qa
- Stage
- Prod
required: true
type: choice
version:
default: v1.0.0
description: Bump Version
required: true
jobs:
push_to_registry:
name: Push Docker image to Registries
env:
IMAGE_NAME: 'puzzle'
REGISTRY_NAMESPACE: 'spaship'
runs-on: ubuntu-latest
steps:
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- name: Check out the repo
uses: actions/checkout@v2
- name: Login to Quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.CI_QUAY_USERNAME }}
password: ${{ secrets.CI_QUAY_TOKEN }}
- name: Dev Build and push into repository
if: github.event.inputs.env == 'Dev'
id: docker_build_dev
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
build-args: |
USERGROUP=${{ secrets.DEV_GIT_BROKER_USERGROUP }}
tags: |
quay.io/${{ env.REGISTRY_NAMESPACE }}/${{ env.IMAGE_NAME }}:dev-${{env.GITHUB_REF_SLUG}}
- name: Image digest
run: echo ${{ steps.docker_build_dev.outputs.digest }}
- name: QA Build and push into repository
if: github.event.inputs.env == 'Qa'
id: docker_build_qa
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
build-args: |
USERGROUP=${{ secrets.QA_GIT_BROKER_USERGROUP }}
tags: |
quay.io/${{ env.REGISTRY_NAMESPACE }}/${{ env.IMAGE_NAME }}:qa-${{env.GITHUB_REF_SLUG}}
- name: Image digest
run: echo ${{ steps.docker_build_dev.outputs.digest }}
- name: Stage Build and push into repository
if: github.event.inputs.env == 'Stage'
id: docker_build_stage
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
build-args: |
USERGROUP=${{ secrets.STAGE_GIT_BROKER_USERGROUP }}
tags: |
quay.io/${{ env.REGISTRY_NAMESPACE }}/${{ env.IMAGE_NAME }}:stage-${{env.GITHUB_REF_SLUG}}
- name: Image digest
run: echo ${{ steps.docker_build_dev.outputs.digest }}
- name: Prod Build and push into repository
if: github.event.inputs.env == 'Prod'
id: docker_build_prod
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
build-args: |
USERGROUP=${{ secrets.PROD_GIT_BROKER_USERGROUP }}
tags: |
quay.io/${{ env.REGISTRY_NAMESPACE }}/${{ env.IMAGE_NAME }}:prod-${{env.GITHUB_REF_SLUG}}
- name: Image digest
run: echo ${{ steps.docker_build_dev.outputs.digest }}