mirror of
https://github.com/chaos-zhu/easynode.git
synced 2026-10-06 12:03:13 +08:00
47 lines
1.3 KiB
YAML
47 lines
1.3 KiB
YAML
name: Build Server to DockerHub
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag_name:
|
|
description: 'Tag Name (leave empty for default latest)'
|
|
required: false
|
|
default: 'latest'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
# 仅构建 server 正式版;跳过 native-* / client* 的 Release,避免误构建并覆盖 latest 镜像
|
|
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && !startsWith(github.event.release.tag_name, 'native-') && !startsWith(github.event.release.tag_name, 'client'))
|
|
steps:
|
|
- name: Check out the repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: |
|
|
chaoszhu/easynode:${{ github.event.release.tag_name || inputs.tag_name }}
|
|
chaoszhu/easynode:latest
|
|
|
|
# - name: Clean up post-build
|
|
# run: docker system prune -af
|