-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (55 loc) · 2.57 KB
/
docker-image.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
57
58
59
60
61
62
63
name: Docker Image Build
on:
workflow_dispatch:
inputs:
image_version:
description: 'The version of the Docker image'
required: true
scope:
description: 'Beta/Release ?'
type: choice
options:
- 'BETA'
- 'RELEASE'
required: true
jobs:
build-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Building the API Docker image
run: |
if [ "${{ inputs.scope }}" = "BETA" ]; then
docker build ./api/ --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:${{ inputs.image_version }} --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:latest-beta
else
docker build ./api/ --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:${{ inputs.image_version }} --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:latest
fi
build-client:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Building the client Docker image
run: |
if [ "${{ inputs.scope }}" = "BETA" ]; then
docker build ./client/ --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:${{ inputs.image_version }} --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:latest-beta
else
docker build ./client/ --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:${{ inputs.image_version }} --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:latest
fi
push-images:
needs: [ build-api, build-client ]
runs-on: ubuntu-latest
steps:
- name: Push the Docker images to the ghcr.io registry
run: |
docker login ghcr.io -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.GITHUB_TOKEN }}
if [ "${{ inputs.scope }}" = "BETA" ]; then
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:latest-beta
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:${{ inputs.image_version }}
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:latest-beta
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:${{ inputs.image_version }}
else
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:latest
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:${{ inputs.image_version }}
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:latest
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:${{ inputs.image_version }}
fi