Skip to content

Update tag.yml

Update tag.yml #8

Workflow file for this run

name: docker_build_push_ghcr
on:
push:
tags:
- "v*.*.*"
pull_request:
branches:
- "main"
jobs:
docker_build_push_ghcr:
name: 'Docker Build and Push to GHCR'
runs-on: ubuntu-latest
environment: production
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v4
- name: Convert repository name to lowercase
id: lowercase
run: echo "lowercase_repo=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Use the lowercase repository name
run: echo "The lowercase repository name is ${{ env.lowercase_repo }}"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ env.lowercase_repo }}
tags: |
type=semver,pattern={{version}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PAT_PACKAGE_TOKEN }}
- name: Build the frontend image and push it to ACR
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}