-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (57 loc) · 1.99 KB
/
publish-docker.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
64
65
66
67
68
69
70
71
name: 🐳 Docker Images
on:
workflow_dispatch:
push:
branches:
- '**'
jobs:
linux-build-and-push:
name: 🐧 Linux Docker Build and Push
runs-on: ubuntu-latest
steps:
- name: 🔍 Checkout Repository
uses: actions/checkout@v4
- name: 🛠️ Setup QEMU
uses: docker/setup-qemu-action@v3
- name: 🛠️ Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 🖥️ Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: 🏷️ Fetch Commit SHA
run: echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: 🏷️ Commit SHA
run: |
source $GITHUB_ENV
echo "SHA_SHORT: ${SHA_SHORT}"
- name: 🏷️ Extract Branch Name
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: 🏷️ Branch Name
run: |
source $GITHUB_ENV
echo "BRANCH_NAME: ${BRANCH_NAME}"
- name: 🏷️ Define Tags
run: |
source $GITHUB_ENV
# Always set the default tags
DEFAULT_TAGS="dublok/whisperdock:${GITHUB_REF_NAME},dublok/whisperdock:${SHA_SHORT}"
echo "TAGS=${DEFAULT_TAGS}" >> $GITHUB_ENV
# Check if GITHUB_REF_NAME starts with 'v' and if so, append 'latest'
if [[ $GITHUB_REF_NAME == v* ]]; then
LATEST_TAGS="${DEFAULT_TAGS},dublok/whisperdock:latest"
echo "TAGS=${LATEST_TAGS}" >> $GITHUB_ENV
fi
- name: 🏷️ Tags
run: |
source $GITHUB_ENV
echo "TAGS: ${TAGS}"
- name: 🛠️ Build and Push Docker Images
uses: docker/build-push-action@v5.0.0
with:
context: ./src
file: ./src/Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/s390x
tags: ${{ env.TAGS }}