mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-22 16:41:30 +00:00
63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
name: Build Docker Images
|
|
|
|
on:
|
|
release:
|
|
types:
|
|
- released
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "The tag version you want to build"
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Get commit to build
|
|
id: ref
|
|
run: |-
|
|
if [[ -z "${{ github.event.inputs.tag }}" ]]; then
|
|
ref="${{ github.ref_name }}"
|
|
else
|
|
ref="${{ github.event.inputs.tag }}"
|
|
fi
|
|
echo "ref=$ref"
|
|
echo "ref=$ref" >> $GITHUB_OUTPUT
|
|
if [[ $ref == *"-"* ]]; then
|
|
latest=latest-beta
|
|
else
|
|
latest=latest
|
|
fi
|
|
echo "latest=$latest"
|
|
echo "latest=$latest" >> $GITHUB_OUTPUT
|
|
- name: Checkout
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
|
with:
|
|
ref: ${{ steps.ref.outputs.ref }}
|
|
- name: Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Setup QEMU for Docker Buildx
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Docker metadata
|
|
id: metadata
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/sagernet/sing-box
|
|
- name: Build and release Docker images
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: linux/386,linux/amd64,linux/arm64,linux/s390x
|
|
context: .
|
|
target: dist
|
|
build-args: |
|
|
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
|
|
tags: |
|
|
ghcr.io/sagernet/sing-box:${{ steps.ref.outputs.latest }}
|
|
ghcr.io/sagernet/sing-box:${{ steps.ref.outputs.ref }}
|
|
push: true
|