-
Notifications
You must be signed in to change notification settings - Fork 181
52 lines (42 loc) · 1.69 KB
/
production-build.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
42
43
44
45
46
47
48
49
50
51
52
name: Unstract Docker Image Build and Push (Production)
on:
workflow_dispatch:
inputs:
tag:
description: "Docker image tag"
required: true
release:
types:
- created
run-name: "[${{ github.event.release.tag_name || github.event.inputs.tag }}] Docker Image Build and Push (Production)"
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
service_name: [backend, frontend, platform-service, prompt-service, worker, x2text-service]
steps:
- name: Checkout code for release
if: github.event_name == 'release'
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
- name: Checkout code for branch
if: github.event_name != 'release'
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push images
working-directory: ./docker
run: |
DOCKER_VERSION_TAG=${{ github.event.release.tag_name || github.event.inputs.tag}}
VERSION=$DOCKER_VERSION_TAG docker compose -f docker-compose.build.yaml build --no-cache ${{ matrix.service_name }}
docker push unstract/${{ matrix.service_name }}:$DOCKER_VERSION_TAG
if [ "${{ github.event_name }}" = "release" ]; then
echo "This workflow was triggered by a release event."
docker tag unstract/${{ matrix.service_name }}:$DOCKER_VERSION_TAG unstract/${{ matrix.service_name }}:latest
docker push unstract/${{ matrix.service_name }}:latest
fi