-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (67 loc) · 2.1 KB
/
Copy pathdocker.yml
File metadata and controls
75 lines (67 loc) · 2.1 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: docker
on:
release:
types:
- published
workflow_dispatch:
inputs:
push:
description: "Push image to DockerHub"
type: boolean
default: true
env:
NAMESPACE: "nciccbr"
IMAGE_NAME: "syncweaver"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.ref_name }}
- name: Determine version and push flag
id: setup
shell: bash
run: |
image_base="${NAMESPACE}/${IMAGE_NAME}"
branch_ref="${{ github.ref_name }}"
syncweaver_ref="${branch_ref}"
if [ "${{ github.event_name }}" = "release" ]; then
version="${{ github.ref_name }}"
tag="${image_base}:${version},${image_base}:latest"
push="true"
else
version="$(tr -d '[:space:]' < VERSION)"
tag="${image_base}:${version}"
push="${{ inputs.push }}"
fi
if [ -z "${version}" ]; then
echo "ERROR: Resolved image version is empty" >&2
exit 1
fi
if [ -z "${syncweaver_ref}" ]; then
echo "ERROR: Resolved SYNCWEAVER_VERSION is empty" >&2
exit 1
fi
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "syncweaver_ref=${syncweaver_ref}" >> "$GITHUB_OUTPUT"
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
echo "push=${push}" >> "$GITHUB_OUTPUT"
- name: Login to DockerHub
if: ${{ steps.setup.outputs.push == 'true' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
push: ${{ steps.setup.outputs.push == 'true' }}
tags: ${{ steps.setup.outputs.tag }}
build-args: |
SYNCWEAVER_VERSION=${{ steps.setup.outputs.syncweaver_ref }}