uLinkShortener/.github/workflows/build.yml
2025-04-02 12:19:29 +02:00

54 lines
No EOL
1.2 KiB
YAML

name: Build Docker Image
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/marcus7i/ulinkshortener
tags: |
type=raw,value=latest
type=sha,format=short
type=ref,event=branch
type=ref,event=pr
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64, linux/arm64/v8
tags: ghcr.io/marcus7i/ulinkshortener:latest
labels: ${{ steps.meta.outputs.labels }}