Skip to content

Adds TokenUsageModel (#17) #10

Adds TokenUsageModel (#17)

Adds TokenUsageModel (#17) #10

name: Build and Push Docker Image
# We want to deploy on all merges to main and any tag push.
# On main push:
# - Build, tag, and push HEAD as `latest`
# On test tag push:
# - Build, tag, and push HEAD as `unstable`
# On prod tag push:
# - Build, tag, and push HEAD as `stable`
# Any other tag:
# - Build, tag, and push HEAD as `<tag>`
on:
push:
branches:
- "main"
tags:
- "*"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=conorjf/fia-api
TAGS=""
if [[ $GITHUB_REF_TYPE == tag ]]; then
if [[ $GITHUB_REF_NAME == test ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:unstable"
elif [[ $GITHUB_REF_NAME == prod ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:stable"
else
TAGS="$TAGS,${DOCKER_IMAGE}:$GITHUB_REF_NAME"
fi
fi
if [[ $GITHUB_REF_TYPE == branch ]]; then
if [[ $GITHUB_REF_NAME == main ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
fi
echo ::set-output name=tags::${TAGS}
- name: Checkout
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
file: ./deploy/Dockerfile
push: true
tags: ${{ steps.prep.outputs.tags }}