ci: switch from gitea to github actions multi-arch build
This commit is contained in:
1 parent
f364821128
commit
1291fd1381
4 files changed
+66
-61
No files matched your search
@@ -1,57 +0,0 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
run: |
|
||||
git clone --depth=1 "https://${{ gitea.actor }}:${{ secrets.GITHUB_TOKEN }}@git.openlocalpdf.com/${{ gitea.repository }}.git" .
|
||||
git checkout "${{ github.sha }}" || true
|
||||
|
||||
- name: Check Runner Environment
|
||||
run: |
|
||||
echo "=== System Info ==="
|
||||
uname -a || true
|
||||
which docker || echo "docker CLI not found!"
|
||||
docker version || echo "docker daemon not accessible!"
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.openlocalpdf.com -u "${{ gitea.actor }}" --password-stdin
|
||||
|
||||
- name: Build and Push Docker image (Multi-Arch)
|
||||
run: |
|
||||
IMAGE_NAME="git.openlocalpdf.com/${{ gitea.repository }}"
|
||||
TAGS="-t ${IMAGE_NAME}:latest"
|
||||
|
||||
# 如果是 tag 触发,则同时打上具体版本 tag
|
||||
if [ "${{ github.ref_type }}" = "tag" ]; then
|
||||
TAG_NAME="${{ github.ref_name }}"
|
||||
echo "Tag detected: ${TAG_NAME}"
|
||||
TAGS="${TAGS} -t ${IMAGE_NAME}:${TAG_NAME}"
|
||||
fi
|
||||
|
||||
echo "Building and pushing multi-arch image: ${TAGS}"
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
${TAGS} \
|
||||
--push \
|
||||
-f Dockerfile .
|
||||
Reference in new issue
Block a user