Files
embyx/.github/workflows/docker-publish.yml
T
juneix 13f74eb7b7 v1.0
2026-03-07 17:36:12 +08:00

50 lines
1.1 KiB
YAML

name: Build and Push Docker Image
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'README_zh.md'
workflow_dispatch:
# 添加权限声明,确保可以推送到 GHCR
permissions:
packages: write
contents: read
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Lowercase the repo name
run: echo "REPO_LOWER=${GITHUB_REPOSITORY_OWNER,,}" >> ${GITHUB_ENV}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ env.REPO_LOWER }}/embyx:latest
cache-from: type=gha
cache-to: type=gha,mode=max