-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.49 KB
/
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
name: Build
on:
push:
branches: [ master ]
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
env:
SERVICE_IMAGE_NAME: chinaboard/brewing-service
WORKER_IMAGE_NAME: chinaboard/brewing-worker
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Log into registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: chinaboard
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get sha short
shell: bash
run: |
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- name: Build and push service image
if: contains(github.event.head_commit.message, 'service')
run: |
docker build -t ${{ env.SERVICE_IMAGE_NAME }}:${{ env.sha_short }} -t ${{ env.SERVICE_IMAGE_NAME }} -f service.Dockerfile .
docker push ${{ env.SERVICE_IMAGE_NAME }}:${{ env.sha_short }}
docker push ${{ env.SERVICE_IMAGE_NAME }}
- name: Build and push worker image
if: contains(github.event.head_commit.message, 'worker')
run: |
docker build -t ${{ env.WORKER_IMAGE_NAME }}:${{ env.sha_short }} -t ${{ env.WORKER_IMAGE_NAME }} -f worker.Dockerfile .
docker push ${{ env.WORKER_IMAGE_NAME }}:${{ env.sha_short }}
docker push ${{ env.WORKER_IMAGE_NAME }}