Skip to content

Commit

Permalink
自动打包 Docker 镜像
Browse files Browse the repository at this point in the history
  • Loading branch information
WankkoRee committed Jul 3, 2024
1 parent 811ade4 commit 2fc8996
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
types:
- published

permissions:
contents: read

jobs:
source:
name: Source
Expand Down Expand Up @@ -105,3 +108,46 @@ jobs:
- name: Build
run: |
make
docker:
name: Docker
runs-on: ubuntu-20.04
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Prepare QEMU
uses: docker/setup-qemu-action@v3
- name: Prepare Buildx
uses: docker/setup-buildx-action@v3
- name: Login GitHub Packages Docker Image Repository
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Format Docker Image Meta
uses: docker/metadata-action@v5
id: docker_meta
with:
images: ghcr.io/${{ github.repository_owner }}/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=nightly,enable={{is_default_branch}}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/386,linux/arm64/v8,linux/arm/v7,linux/arm/v6,linux/riscv64
push: true
provenance: false
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

0 comments on commit 2fc8996

Please sign in to comment.