Files
shell/.github/workflows/docker-ghcr.yml
2025-07-16 12:35:21 +00:00

42 lines
1.1 KiB
YAML

name: ghcr镜像构建
on:
workflow_dispatch:
inputs:
version:
description: 'Version number'
required: true
default: 'ansible'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set version from input
run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Build and push Docker image
run: |
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
--tag ghcr.io/${{ github.repository }}:${{ env.VERSION }} \
--build-arg VERSION=${{ env.VERSION }} \
./ansible
env:
GHCR_PUBLIC: true