57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
# this is the first time I write a github / gitea actions workflow myself, so excuse me if it sucks
|
|
name: Build and publish bnuy api
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
# this step was made by AI, i hope it works
|
|
- name: Extract registry host
|
|
id: registry
|
|
run: echo "host=$(echo ${{ github.server_url }} | sed 's|https\?://||')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: ${{ steps.registry.outputs.host }}/${{ github.repository }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Login to Gitea Container Registry
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ${{ steps.registry.outputs.host }}
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.REPO_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|