Publish Frontend Image to GHCR #1
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: Publish Frontend Image to GHCR | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Image tag' | |
required: true | |
default: 'latest' | |
env: | |
IMAGE_NAME: frontend | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=${{ github.event.inputs.tag }} | |
type=sha,prefix={{date 'YYYYMMDD'}}- | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./frontend | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |