-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (47 loc) · 1.88 KB
/
build_sync.yml
File metadata and controls
54 lines (47 loc) · 1.88 KB
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
name: Build SYNC
on:
workflow_dispatch:
push:
branches:
- master
env:
DOCKER_HUB_IMAGE_NAME: "amd64-arm64"
jobs:
build_push_api:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
#Allow multiplateform to be able to deply on rasp
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
#Compute tags
- name: Compute Docker tags
id: compute-tags
run: |
PACKAGE_VERSION=$(cat package.json | jq -r '.version')
DOCKER_HUB_TAG_BASE=sync/${DOCKER_HUB_IMAGE_NAME}:${{github.ref_name}}
DOCKER_HUB_TAG_LATEST=${DOCKER_HUB_TAG_BASE}-latest
# Conditional version tag (only for prod)
if [ "${{github.ref_name}}" = "prod" ]; then
DOCKER_HUB_TAG_VERSION=${DOCKER_HUB_TAG_BASE}-${PACKAGE_VERSION}
else
DOCKER_HUB_TAG_VERSION=""
fi
echo "tag_latest=${DOCKER_HUB_TAG_LATEST}" >> $GITHUB_OUTPUT
echo "tag_version=${DOCKER_HUB_TAG_VERSION}" >> $GITHUB_OUTPUT
#Debug tags
- name: Debug tags
run: |
echo "Latest: ${{ steps.compute-tags.outputs.tag_latest }}"
echo "Version: ${{ steps.compute-tags.outputs.tag_version }}"
#Build and push docker image
- name: Build and push image amd64 & arm64
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
tags: |
${{ steps.compute-tags.outputs.tag_latest }}
${{ steps.compute-tags.outputs.tag_version }}