Archived
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
name: Build and push image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
tags:
|
|
- 'v*'
|
|
|
|
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: Login to Gitea registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.dev.blueoceanswim.com
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Compute tags
|
|
id: tags
|
|
run: |
|
|
IMAGE="gitea.dev.blueoceanswim.com/donny/imagelab-runpod"
|
|
TAGS="${IMAGE}:latest"
|
|
if [ -n "${GITHUB_REF_NAME:-}" ] && [ "${GITHUB_REF_TYPE:-}" = "tag" ]; then
|
|
TAGS="${TAGS},${IMAGE}:${GITHUB_REF_NAME}"
|
|
fi
|
|
SHA_SHORT=$(echo "${GITHUB_SHA}" | cut -c1-7)
|
|
TAGS="${TAGS},${IMAGE}:${SHA_SHORT}"
|
|
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.tags.outputs.tags }}
|
|
cache-from: type=registry,ref=gitea.dev.blueoceanswim.com/donny/imagelab-runpod:buildcache
|
|
cache-to: type=registry,ref=gitea.dev.blueoceanswim.com/donny/imagelab-runpod:buildcache,mode=max
|