Update image #90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |