-
Notifications
You must be signed in to change notification settings - Fork 39
56 lines (48 loc) · 1.5 KB
/
docker.yml
File metadata and controls
56 lines (48 loc) · 1.5 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
# .github/workflows/docker.yml
# Builds and pushes Docker image to Docker Hub
name: Docker
on:
# Automatically after a GitHub Release is published
release:
types: [published]
# Manually for snapshot builds
workflow_dispatch:
inputs:
tag:
description: 'Docker image tag'
required: true
default: 'snapshot'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Determine tags
id: tags
run: |
if [ "${{ github.event_name }}" = "release" ]; then
VERSION="${{ github.event.release.tag_name }}"
echo "tags=convexlive/convex:${VERSION},convexlive/convex:latest" >> "$GITHUB_OUTPUT"
else
echo "tags=convexlive/convex:${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
fi
- name: Build Docker image
run: |
IFS=',' read -ra TAGS <<< "${{ steps.tags.outputs.tags }}"
TAG_ARGS=""
for TAG in "${TAGS[@]}"; do
TAG_ARGS="$TAG_ARGS -t $TAG"
done
docker build $TAG_ARGS .
- name: Push Docker image
run: |
IFS=',' read -ra TAGS <<< "${{ steps.tags.outputs.tags }}"
for TAG in "${TAGS[@]}"; do
docker push "$TAG"
done