More configurable env vars #16
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 Publish | |
on: | |
push: | |
branches: [master] | |
paths-ignore: | |
- 'README.md' | |
- 'docs/**' | |
- '**.png' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GH_TOKEN }} | |
- name: Convert repository name to lowercase | |
run: echo "REPO_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Get short SHA | |
id: short_sha | |
run: echo "::set-output name=sha::$(git rev-parse --short HEAD)" | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: | | |
${{ steps.meta.outputs.tags }} | |
ghcr.io/${{ env.REPO_NAME }}:latest | |
ghcr.io/${{ env.REPO_NAME }}:${{ steps.short_sha.outputs.sha }} |