2024-10-21 13:29:20 +00:00
|
|
|
name: Build and Push Docker Image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
tags:
|
|
|
|
- "v*"
|
|
|
|
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ gitea.repository }}
|
|
|
|
|
|
|
|
jobs:
|
2024-10-21 13:32:56 +00:00
|
|
|
docker-build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
image: ghcr.io/catthehacker/ubuntu:act-latest
|
|
|
|
volumes:
|
|
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
2024-10-21 13:29:20 +00:00
|
|
|
steps:
|
|
|
|
- name: ⬇️ Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
2024-10-21 13:36:00 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
token: ${{ secrets.FORGEJO_TOKEN }}
|
2024-10-21 13:29:20 +00:00
|
|
|
|
|
|
|
- name: 👤 Log in to the Container registry
|
|
|
|
uses: github.com/docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ gitea.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: ✏️ Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
|
|
|
uses: github.com/docker/metadata-action@v4
|
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=tag
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
type=sha
|
|
|
|
|
|
|
|
- name: 🛠️ Build and push Docker image
|
|
|
|
uses: github.com/docker/build-push-action@v4
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|