-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (78 loc) · 2.67 KB
/
docker-publish.yaml
File metadata and controls
92 lines (78 loc) · 2.67 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
92
name: Docker
on:
push:
branches:
- main
tags:
- v*
# schedule:
# - cron: '0 16 * * *' # Every day at 16:00 UTC (~09:00 PT)
jobs:
# Push container image to GitHub Packages and Docker Hub.
# See also https://docs.docker.com/docker-hub/builds/
deploy:
name: Docker image build
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- name: Checkout code
uses: nschloe/[email protected]
with:
exclude: "examples/example[2-4].wav"
- uses: docker/setup-qemu-action@v3
name: Set up QEMU
id: qemu
- uses: docker/setup-buildx-action@v3
name: Set up Docker Buildx
id: buildx
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
# Log into container registries
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ vars.BATBOT_DOCKERHUB_USERNAME }}
password: ${{ secrets.BATBOT_DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Push bleeding-edge image ("<branch name>" tag) to registries
- name: Bleeding Edge Docker Hub (Default Option)
run: |
TAG=$(echo ${GITHUB_REF_NAME} | sed 's/\//-/')
echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV
# Push nightly image ("nightly" tag) to registries
- name: Nightly Docker Hub
if: github.event_name == 'schedule'
run: |
echo "IMAGE_TAG=nightly" >> $GITHUB_ENV
# Push tagged image ("<symantic version>" tag) to registries
- name: Tagged Docker Hub
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
run: |
VERSION=$(echo ${GITHUB_REF} | sed 's#.*/v##')
echo "IMAGE_TAG=${VERSION}" >> $GITHUB_ENV
# Build images
- name: Build Batbot
run: |
docker buildx build \
-t kitware/batbot:${{ env.IMAGE_TAG }} \
-t ghcr.io/kitware/batbot:${{ env.IMAGE_TAG }} \
--platform linux/amd64 \
--push \
.
# Also push latest image
- name: Build Batbot
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
run: |
docker buildx build \
-t kitware/batbot:latest \
-t ghcr.io/kitware/batbot:latest \
--platform linux/amd64 \
--push \
.