-
Notifications
You must be signed in to change notification settings - Fork 20
59 lines (52 loc) · 1.6 KB
/
update-image.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
name: Update image
on:
push:
branches:
- '**'
tags-ignore:
- '**'
paths:
- Dockerfile
- requirements.txt
- package.json
- yarn.lock
- .github/workflows/update-image.yml
# Manually triggered using `./vendored/trigger nextstrain/ncov-ingest update-image`
repository_dispatch:
types: update-image
# Manually triggered using GitHub's UI
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: docker.io
username: nextstrainbot
password: ${{ secrets.DOCKER_TOKEN }}
- name: Describe git revision for image build arg
run: |
echo "GIT_REVISION=$(git describe --always --long --dirty)" | tee -a "$GITHUB_ENV"
- name: Determine image tag
run: |
if [[ "$GITHUB_REF_NAME" == master ]]; then
IMAGE_TAG=latest
else
IMAGE_TAG="branch-${GITHUB_REF_NAME//[^A-Za-z0-9._-]/-}"
fi
echo "IMAGE_TAG=$IMAGE_TAG" | tee -a "$GITHUB_ENV"
- uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: nextstrain/ncov-ingest:${{ env.IMAGE_TAG }}
cache-from: |
type=registry,ref=nextstrain/ncov-ingest:latest
type=registry,ref=nextstrain/ncov-ingest:${{ env.IMAGE_TAG }}
cache-to: type=inline,mode=max
build-args: |
GIT_REVISION=${{ env.GIT_REVISION }}