Fixed path case sensitivity #32
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: Docker Image CI | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
tags: | |
- '*' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Prepare | |
id: prep | |
run: | | |
OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
DOCKER_IMAGE=ghcr.io/$OWNER/hkn-website | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
TAGS="$DOCKER_IMAGE:$VERSION,$DOCKER_IMAGE:latest" | |
elif [[ $GITHUB_REF == refs/heads/main ]]; then | |
VERSION=main-$(git rev-parse --short ${{ github.sha }}) | |
TAGS="$DOCKER_IMAGE:$VERSION,$DOCKER_IMAGE:latest" | |
elif [[ $GITHUB_REF == refs/heads/develop ]]; then | |
VERSION=dev-$(git rev-parse --short ${{ github.sha }}) | |
TAGS="$DOCKER_IMAGE:$VERSION,$DOCKER_IMAGE:test" | |
else | |
VERSION=$(git rev-parse --short ${{ github.sha }}) | |
TAGS="$DOCKER_IMAGE:$VERSION" | |
fi | |
echo ::set-output name=version::$VERSION | |
echo ::set-output name=tags::$TAGS | |
shell: bash | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.prep.outputs.tags }} |