Skip to content

0.1.2

0.1.2 #5

Workflow file for this run

name: Build and Push OCI
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag for the Docker image'
required: true
release:
types: [published]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract release tag
id: extract_tag
if: github.event_name == 'release'
run: echo "tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
run: |
TAG=${{ github.event_name == 'release' && steps.extract_tag.outputs.tag || github.event.inputs.tag }}
docker build -t ghcr.io/${{ github.repository }}:latest -t ghcr.io/${{ github.repository }}:${TAG} .
docker push ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:${TAG}