SPAship puzzle build and push into container repository #132
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |