-
Notifications
You must be signed in to change notification settings - Fork 14
53 lines (47 loc) · 1.53 KB
/
api.cd.yml
File metadata and controls
53 lines (47 loc) · 1.53 KB
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
name: "API [CD]"
on:
push:
branches:
- 'dev'
- 'ops'
- 'main'
paths:
- 'build/package/api/**'
- 'api/**'
- '.github/**'
jobs:
RELEASE:
name: RELEASE
runs-on: ubuntu-latest
steps:
# Checkout to current workspace
- name: 1 - CHECKOUT
uses: actions/checkout@v2
# Login to container registry
- name: 2 - LOGIN TO GHCR.IO
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GPAT }}
# Setup custom tag name
- name: 3 - SETUP ENV VARS
run: |
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | head -c8)" >> $GITHUB_ENV
echo "CURRENT_DATE=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "BRANCH_NAME=$GITHUB_REF_NAME" >> $GITHUB_ENV
# Build and push the app with given file and tag
- name: 4 - BUILD + PUSH
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
context: .
file: build/package/api/Dockerfile.prod
tags: |
ghcr.io/terraform-gui/tf-gui_api:${{ env.BRANCH_NAME }}-${{ env.GITHUB_SHA_SHORT }}-${{ env.CURRENT_DATE }}
ghcr.io/terraform-gui/tf-gui_api:${{ env.BRANCH_NAME }}-${{ env.GITHUB_SHA_SHORT }}
ghcr.io/terraform-gui/tf-gui_api:latest
# output the logs
- name: 5 - IMAGE DIGEST
run: echo ${{ steps.docker_build.outputs.digest }}