Skip to content

Publish Docker Images #119

Publish Docker Images

Publish Docker Images #119

Workflow file for this run

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
if [[ $ref == *"-"* ]]; then
latest="ghcr.io/sagernet/sing-box:latest-beta"
else
latest="ghcr.io/sagernet/sing-box:latest"
fi
versioned="ghcr.io/sagernet/sing-box:$ref"
echo "::set-output name=ref::$ref"
echo "::set-output name=latest::$latest"
echo "::set-output name=versioned::$versioned"
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # 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@v5
with:
platforms: linux/386,linux/amd64,linux/arm64,linux/s390x
target: dist
build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
tags: |-
${{ steps.tag.outputs.latest }}
${{ steps.tag.outputs.versioned }}
push: true