09e3b6ca66
Build and Push Image / build (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
56 lines
1.8 KiB
YAML
56 lines
1.8 KiB
YAML
# Build and push Stoat Role Bot image to Gitea Container Registry on push to main.
|
|
#
|
|
# Setup in Gitea:
|
|
# 1. Repository → Settings → Secrets: add REGISTRY_USER and REGISTRY_PASSWORD
|
|
# (use your Gitea username and password, or a Personal Access Token with package write).
|
|
# 2. Optional: set variable REGISTRY_IMAGE to e.g. mygitea.com/john/stoat-role-bot
|
|
# (default: server_url/owner/repo name).
|
|
#
|
|
# On your NAS: pull this image and run; use Watchtower or a cron job to pull:latest and restart.
|
|
|
|
name: Build and Push Image
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Image tag and registry host
|
|
id: meta
|
|
run: |
|
|
URL="${{ gitea.server_url }}"
|
|
REG="${URL#*://}"
|
|
OWNER="${{ gitea.repository.owner.user_name }}"
|
|
[ -z "$OWNER" ] && OWNER="${{ gitea.repository.owner.login }}"
|
|
[ -z "$OWNER" ] && OWNER="${GITEA_REPOSITORY_OWNER:-}"
|
|
echo "tag=${REG}/${OWNER}/stoat-role-bot:latest" >> $GITHUB_OUTPUT
|
|
echo "registry=${REG}" >> $GITHUB_OUTPUT
|
|
env:
|
|
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
|
GITEA_REPOSITORY_OWNER: ${{ gitea.repository.owner.user_name }}
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ steps.meta.outputs.registry }}
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tag }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|