update
This commit is contained in:
41
.github/workflows/docker-ghcr.yml
vendored
Normal file
41
.github/workflows/docker-ghcr.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
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
|
||||
Reference in New Issue
Block a user