-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (78 loc) · 2.31 KB
/
docker-publish.yml
File metadata and controls
91 lines (78 loc) · 2.31 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Docker Publish
on:
push:
branches:
- master
tags:
- "*"
workflow_dispatch:
jobs:
commit-message-guard:
name: Check Commit Message
runs-on: ubuntu-latest
outputs:
run_ci: ${{ steps.check.outputs.run_ci }}
steps:
- name: Check out triggering commit
uses: actions/checkout@v5
with:
ref: ${{ github.sha }}
fetch-depth: 1
- name: Check for /noci marker
id: check
shell: bash
run: |
set -euo pipefail
message="$(git log -1 --format=%B)"
if [[ "${message}" == *"/noci"* ]]; then
echo "run_ci=false" >> "${GITHUB_OUTPUT}"
exit 0
fi
echo "run_ci=true" >> "${GITHUB_OUTPUT}"
publish:
name: Build And Push ${{ matrix.backend.name }} Image
if: ${{ needs.commit-message-guard.outputs.run_ci == 'true' }}
needs: commit-message-guard
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
backend:
- name: PyTorch
image: sablecrestlabs/histovae-pytorch
dockerfile: pytorch/Dockerfile
- name: TensorFlow
image: sablecrestlabs/histovae-tensorflow
dockerfile: tensorflow/Dockerfile
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract Docker metadata
id: meta
shell: bash
run: |
set -euo pipefail
image="${{ matrix.backend.image }}"
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
tag="${GITHUB_REF_NAME}"
{
echo "tags=${image}:latest,${image}:${tag}"
echo "version_tag=${tag}"
} >> "${GITHUB_OUTPUT}"
else
echo "tags=${image}:latest" >> "${GITHUB_OUTPUT}"
fi
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
file: ${{ matrix.backend.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}