Skip to content

cd-flow

cd-flow #18

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: cd-flow
on:
workflow_run:
workflows: ["ci-flow"]
types:
- completed
env:
REGISTRY: ghcr.io
USER_NAME: im-qarch
IMAGE_NAME: go-automatic-chainsaw
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GIT_PERSONAL_ACCESS_TOKEN }}
- name: Load secrets and save to app.env
run: |
echo $APP_ENV | base64 --decode > app.env
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.USER_NAME }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.USER_NAME }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}