fix which docker repos to use #2
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: Build and Publish Docker Image | |
on: | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Set up Docker Buildx | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Log in to GitHub Container Registry | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Extract the tag name from the push event | |
- name: Get Git Tag | |
id: get_tag | |
run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
# Build the Docker image | |
- name: Build Docker image | |
run: | | |
docker build -t ghcr.io/${{ github.repository }}:${{ env.TAG }} . | |
# Push the Docker image to GitHub Container Registry | |
- name: Push Docker image | |
run: | | |
docker push ghcr.io/${{ github.repository }}:${{ env.TAG }} |