Publish Container #8
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 Container | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag for the Docker image' | |
required: false | |
default: 'latest' # Default tag is 'latest' if no input is provided | |
permissions: | |
contents: read | |
pages: write | |
packages: write | |
id-token: write | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Step 2: Log in to GitHub Container Registry (GHCR) | |
- name: Log in to GHCR | |
uses: redhat-actions/podman-login@v1 | |
with: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
registry: ghcr.io | |
# Step 3: Build the Docker image using Podman | |
- name: Build Docker image with Podman | |
run: | | |
podman build -t gamedoora-ui . | |
# Step 4: Tag the image with the appropriate tag | |
- name: Tag the image | |
run: | | |
podman tag gamedoora-ui ghcr.io/${{ github.repository }}:${{ github.event.inputs.tag }} | |
# Step 5: Push the image to GitHub Container Registry (GHCR) | |
- name: Push image to GHCR | |
run: | | |
podman push ghcr.io/${{ github.repository }}:${{ github.event.inputs.tag }} | |
# Step 6: Output image URL for reference | |
- name: Output pushed image URL | |
run: echo "Image pushed to ghcr.io/${{ github.repository }}:${{ github.event.inputs.tag }}" |