-
Notifications
You must be signed in to change notification settings - Fork 4
56 lines (53 loc) · 2.13 KB
/
docker-publish.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
55
56
name: Build and publish a Docker image to ghcr.io
on:
workflow_dispatch:
inputs:
SERVICE_NAME:
required: true
type: string
description: "service name to release: gorya-backend || gorya-ui"
IMAGE_TAG:
required: true
type: string
description: "tag for container image"
jobs:
backend_image_publish:
runs-on: "ubuntu-20.04"
if: ${{ inputs.SERVICE_NAME == 'gorya-backend' }}
env:
SERVICE_NAME: ${{ inputs.SERVICE_NAME }}
IMAGE_TAG: ${{ inputs.IMAGE_TAG }}
steps:
- uses: actions/checkout@v2
- name: "Checkout GitHub Action"
uses: actions/checkout@main
- name: "Login to GitHub Container Registry"
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GH_PAT}}
- name: "Build Backend Image"
run: |
docker build --build-arg VERSION=${{ env.IMAGE_TAG }} --build-arg GIT_COMMIT=${{ github.sha }} --build-arg GIT_TREE_STATE=clean --build-arg GH_ACTOR=${{github.actor}} --build-arg GH_REPO=${{ github.event.repository.name }} -f backend.Dockerfile . --tag ghcr.io/${{github.actor}}/gorya-backend:${{ env.IMAGE_TAG }}
docker push ghcr.io/${{github.actor}}/gorya-backend:${{ env.IMAGE_TAG }}
ui_image_publish:
runs-on: "ubuntu-20.04"
if: ${{ inputs.SERVICE_NAME == 'gorya-ui' }}
env:
SERVICE_NAME: ${{ inputs.SERVICE_NAME }}
IMAGE_TAG: ${{ inputs.IMAGE_TAG }}
steps:
- uses: actions/checkout@v2
- name: "Checkout GitHub Action"
uses: actions/checkout@main
- name: "Login to GitHub Container Registry"
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GH_PAT}}
- name: "Build UI Image"
run: |
docker build --build-arg GH_ACTOR=${{github.actor}} --build-arg GH_REPO=${{ github.event.repository.name }} -f frontend.Dockerfile . --tag ghcr.io/${{github.actor}}/gorya-ui:${{ env.IMAGE_TAG }}
docker push ghcr.io/${{github.actor}}/gorya-ui:${{ env.IMAGE_TAG }}