generated from gogolcorp/go-yave
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (43 loc) · 1.26 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
name: "CD"
on:
push:
branches:
- main
paths:
- "**/*.go"
- "**/go.*"
jobs:
CD:
name: CD
runs-on: ubuntu-latest
steps:
# Checkout to current workspace
- name: 1 - CHECKOUT
uses: actions/checkout@v3
# Login to container registry
- name: 2 - LOGIN TO GHCR.IO
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Setup variable for Docker tag
- name: 3 - SETUP ENV VARS
run: |
echo "SHA=$(echo $GITHUB_SHA | head -c8)" >> $GITHUB_ENV
echo "DATE=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
# Build and push the app with given file and tag
- name: 4 - BUILD + PUSH
id: docker_build
uses: docker/build-push-action@v3
with:
push: true
context: .
file: build/package/go-eland/Dockerfile
tags: |
ghcr.io/gogolcorp/go-eland:${{ env.SHA }}-${{ env.DATE }}
ghcr.io/gogolcorp/go-eland:${{ env.SHA }}
ghcr.io/gogolcorp/go-eland:latest
# Output the logs
- name: 5 - IMAGE DIGEST
run: echo ${{ steps.docker_build.outputs.digest }}