-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (45 loc) · 1.59 KB
/
cd.yml
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
# 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
push:
branches: ["dev"]
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: |
$APP_ENV | jq -r > app.env
cat ./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 }}