-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (36 loc) · 1.18 KB
/
build-and-deploy-image.yaml
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
name: Build and Deploy Docker Image
on:
workflow_dispatch:
# push:
# branches:
# - main
# release:
# types: [published]
jobs:
test:
uses: monarch-initiative/monarch-trapi-kp/.github/workflows/test.yml@main
build-and-push-api-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # to get all tags
- name: Generate Image Tag
id: get-tag
run: |
REV=$(git rev-list --tags --max-count=1)
IMAGE_TAG=$(git describe --tags $REV)
echo "IMAGE_TAG=${IMAGE_TAG//v}"
echo "IMAGE_TAG=${IMAGE_TAG//v}" >> $GITHUB_OUTPUT
- name: Prepare to Build Image
run: cp .env-template .env
- name: Build and Push Image
uses: RafikFarhad/push-to-gcr-github-action@v5-beta
with:
gcloud_service_key: ${{ secrets.JSON_GCLOUD_SERVICE_ACCOUNT_JSON }}
registry: us-central1-docker.pkg.dev
project_id: monarch-initiative
image_name: monarch-api/monarch-mcq-trapi
image_tag: latest, ${{ steps.get-tag.outputs.IMAGE_TAG }}, ${{ github.sha }}
dockerfile: ./Dockerfile