2022-08-27 14:55:55 +00:00
|
|
|
name: Build Docker Images
|
2024-01-24 04:13:12 +00:00
|
|
|
|
2022-08-27 14:55:55 +00:00
|
|
|
on:
|
2024-01-24 04:13:12 +00:00
|
|
|
release:
|
|
|
|
types:
|
2024-02-24 13:51:39 +00:00
|
|
|
- released
|
2024-05-03 10:52:54 +00:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
tag:
|
|
|
|
description: "The tag version you want to build"
|
2022-08-27 14:55:55 +00:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-05-03 10:52:54 +00:00
|
|
|
- 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
|
2022-08-27 14:55:55 +00:00
|
|
|
- name: Checkout
|
2024-06-16 10:19:54 +00:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
2024-05-03 10:52:54 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ steps.ref.outputs.ref }}
|
2022-08-27 14:55:55 +00:00
|
|
|
- name: Setup Docker Buildx
|
2023-09-17 05:12:03 +00:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-10-29 10:01:11 +00:00
|
|
|
- name: Setup QEMU for Docker Buildx
|
2023-09-17 05:12:03 +00:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2022-08-27 14:55:55 +00:00
|
|
|
- name: Login to GitHub Container Registry
|
2023-09-17 05:12:03 +00:00
|
|
|
uses: docker/login-action@v3
|
2022-08-27 14:55:55 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Docker metadata
|
|
|
|
id: metadata
|
2023-09-17 05:12:03 +00:00
|
|
|
uses: docker/metadata-action@v5
|
2022-08-27 14:55:55 +00:00
|
|
|
with:
|
|
|
|
images: ghcr.io/sagernet/sing-box
|
|
|
|
- name: Build and release Docker images
|
2024-06-18 10:09:33 +00:00
|
|
|
uses: docker/build-push-action@v6
|
2022-08-27 14:55:55 +00:00
|
|
|
with:
|
2022-10-26 11:29:27 +00:00
|
|
|
platforms: linux/386,linux/amd64,linux/arm64,linux/s390x
|
2024-05-03 10:52:54 +00:00
|
|
|
context: .
|
2022-08-27 14:55:55 +00:00
|
|
|
target: dist
|
2023-11-14 02:34:38 +00:00
|
|
|
build-args: |
|
|
|
|
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
|
2022-10-29 10:01:11 +00:00
|
|
|
tags: |
|
2024-05-03 10:52:54 +00:00
|
|
|
ghcr.io/sagernet/sing-box:${{ steps.ref.outputs.latest }}
|
|
|
|
ghcr.io/sagernet/sing-box:${{ steps.ref.outputs.ref }}
|
2022-10-26 11:29:27 +00:00
|
|
|
push: true
|