Skip to content

Workflow file for this run

name: Build and Push Docker Image
on:
push:
tags:
- "v*.*.*"
- "v*.*.*-beta.*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout backend repository
uses: actions/checkout@v2
- name: Get current tag
id: get_tag
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "stable" # 使用你需要的 Go 版本
- name: Build
run: |
go build -o clashmerge .
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
run: |
TAG=${GITHUB_REF#refs/tags/}
if [[ "$TAG" == *-beta.* ]]; then
docker buildx build --platform linux/amd64,linux/arm64 -t mailth/clashmerge:$TAG --push .
else
docker buildx build --platform linux/amd64,linux/arm64 -t mailth/clashmerge:$TAG -t mailth/clashmerge:latest --push .
fi