Skip to content

feat: expose sanitizer as an api #32

feat: expose sanitizer as an api

feat: expose sanitizer as an api #32

name: Docker
on:
push:
env:
IMAGE_NAME: tail-web
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- name: Generate Image Tag
id: image-tag
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
echo "::set-output name=TAG::${IMAGE_ID}:${VERSION}"
- name: Log into GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
pull: true
tags: ${{ steps.image-tag.outputs.TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64