Files
Alek Kim b8efcb0859
/ build (push) Successful in 23m24s
cicd: fix Push Docker Image step
2026-07-13 15:03:56 +09:00

72 lines
1.9 KiB
YAML

on:
push:
tags:
- '*.*.*'
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Extract Registry Hostname
id: registry
run: |
# Strip https:// or http:// prefix using bash parameter expansion
URL="${{ github.server_url }}"
HOST="${URL#*://}"
echo "host=$HOST" >> "$GITHUB_OUTPUT"
- name: Docker Meta Action
uses: docker/metadata-action@v6
id: meta
with:
images: ${{ steps.registry.outputs.host }}/${{ github.repository }}
tags: |
type=ref,event=tag
type=sha,format=short
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Log in to Gitea Container Registry
uses: docker/login-action@v4
with:
registry: ${{ steps.registry.outputs.host }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.TOKEN }}
- name: Build Docker image
uses: docker/build-push-action@v7
with:
context: .
load: true
tags: ${{ steps.meta.outputs.tags }}
build-args:
GITEA_VERSION=${{ github.ref_name }}
- name: Test Docker Image
run: |
docker run --rm ${{ steps.registry.outputs.host }}/${{ github.repository }}:${{ github.ref_name }} jupyter --version
- name: Push Docker Image
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args:
GITEA_VERSION=${{ github.ref_name }}