Merge pull request #41 from foriequal0/fix/impersonate #21
Workflow file for this run
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: Release image | |
on: | |
push: | |
tags: | |
- v* | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Publish image | |
runs-on: ubuntu-latest | |
env: | |
IMG_NAME: pod-graceful-drain | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: | | |
docker build --file docker/build.Dockerfile \ | |
--tag "$IMG_NAME:latest" \ | |
. | |
- name: Tag and push | |
run: | | |
GIT_VERSION=$(git describe --tags --dirty --always) | |
REGISTRY=ghcr.io/${{ github.repository_owner }} | |
tag-and-push() { docker tag $1 $2 && docker push $2; } | |
tag-and-push $IMG_NAME:latest $REGISTRY/$IMG_NAME:$GIT_VERSION | |
LATEST_TAG="$(git describe --tags --dirty --always --abbrev=0)" | |
if git diff --quiet "$LATEST_TAG"; then | |
tag-and-push $IMG_NAME:latest $REGISTRY/$IMG_NAME:latest | |
fi |