update: release build action
This commit is contained in:
parent
8cef4e15bf
commit
865cd62d77
1 changed files with 24 additions and 31 deletions
55
.github/workflows/build-singbox-docker.yml
vendored
55
.github/workflows/build-singbox-docker.yml
vendored
|
@ -1,31 +1,19 @@
|
||||||
name: Build Docker Images
|
name: Build Docker Images (Release)
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
tag:
|
tag:
|
||||||
description: "The tag version or branch you want to build"
|
description: "The tag version you want to build"
|
||||||
required: true
|
required: true
|
||||||
default: "main"
|
default: "main"
|
||||||
buildType:
|
|
||||||
description: "The type of build you want to build"
|
|
||||||
required: true
|
|
||||||
default: 'standard'
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- standard
|
|
||||||
- minimized
|
|
||||||
- full
|
|
||||||
distro:
|
|
||||||
description: "The distro you want to build"
|
|
||||||
required: true
|
|
||||||
default: 'alpine'
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- alpine
|
|
||||||
- distroless
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
buildType: [standard, minimized, full]
|
||||||
|
distro: [alpine, distroless]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Action Repo
|
- name: Checkout Action Repo
|
||||||
|
@ -36,7 +24,7 @@ jobs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: 'SagerNet/sing-box'
|
repository: 'SagerNet/sing-box'
|
||||||
ref: ${{ github.event.inputs.branch }}
|
ref: ${{ github.event.inputs.tag }}
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
@ -44,26 +32,27 @@ jobs:
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
- name: Select Dockerfile
|
- name: Select Dockerfile
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ github.event.inputs.buildType }}" == "full" ]]; then
|
if [[ "${{ matrix.buildType }}" == "full" ]]; then
|
||||||
if [[ "${{ github.event.inputs.distro }}" == "distroless" ]]; then
|
if [[ "${{ matrix.distro }}" == "distroless" ]]; then
|
||||||
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.full" > Dockerfile
|
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.full" > Dockerfile
|
||||||
echo "tag_postfix=-full-distroless" >> $GITHUB_OUTPUT
|
echo "tag_postfix=full-distroless" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.full" > Dockerfile
|
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.full" > Dockerfile
|
||||||
echo "tag_postfix=-full" >> $GITHUB_OUTPUT
|
echo "tag_postfix=full" >> $GITHUB_OUTPUT
|
||||||
if [[ "${{ github.event.inputs.distro }}" == "distroless" ]]; then
|
if [[ "${{ matrix.distro }}" == "distroless" ]]; then
|
||||||
fi
|
fi
|
||||||
elif [[ "${{ github.event.inputs.buildType }}" == "minimized" ]]; then
|
elif [[ "${{ matrix.buildType }}" == "minimized" ]]; then
|
||||||
if [[ "${{ github.event.inputs.distro }}" == "distroless" ]]; then
|
if [[ "${{ matrix.distro }}" == "distroless" ]]; then
|
||||||
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.minimized" > Dockerfile
|
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.minimized" > Dockerfile
|
||||||
echo "tag_postfix=-mini-distroless" >> $GITHUB_OUTPUT
|
echo "tag_postfix=mini-distroless" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.minimized" > Dockerfile
|
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.minimized" > Dockerfile
|
||||||
echo "tag_postfix=-mini" >> $GITHUB_OUTPUT
|
echo "tag_postfix=mini" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ "${{ github.event.inputs.distro }}" == "distroless" ]]; then
|
if [[ "${{ matrix.distro }}" == "distroless" ]]; then
|
||||||
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.standard" > Dockerfile
|
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.distroless.standard" > Dockerfile
|
||||||
|
echo "tag_postfix=distroless" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.standard" > Dockerfile
|
cp "$GITHUB_WORKSPACE/action/dockerfiles/Dockerfile.standard" > Dockerfile
|
||||||
fi
|
fi
|
||||||
|
@ -85,7 +74,11 @@ jobs:
|
||||||
if [[ -z "${{ github.event.inputs.tag }}" ]]; then
|
if [[ -z "${{ github.event.inputs.tag }}" ]]; then
|
||||||
echo "versioned=etnperlong/sing-box:${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
echo "versioned=etnperlong/sing-box:${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "versioned=etnperlong/sing-box:${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
|
if [[ -z ${{ steps.tag.outputs.tag_postfix }} ]]; then
|
||||||
|
echo "versioned=etnperlong/sing-box:${{ github.event.inputs.tag }}-${{ steps.tag.outputs.tag_postfix }}" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "versioned=etnperlong/sing-box:${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
- name: Build and release Docker images
|
- name: Build and release Docker images
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
|
|
Loading…
Reference in a new issue