2022-08-27 14:55:55 +00:00
|
|
|
name: Build Docker Images
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
tag:
|
|
|
|
description: "The tag version you want to build"
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-04 13:36:29 +00:00
|
|
|
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
|
2022-08-27 14:55:55 +00:00
|
|
|
- name: Setup Docker Buildx
|
2023-02-09 09:42:06 +00:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-10-29 10:01:11 +00:00
|
|
|
- name: Setup QEMU for Docker Buildx
|
|
|
|
uses: docker/setup-qemu-action@v2
|
2022-08-27 14:55:55 +00:00
|
|
|
- name: Login to GitHub Container Registry
|
2023-02-09 09:42:06 +00:00
|
|
|
uses: docker/login-action@v2
|
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-02-09 09:42:06 +00:00
|
|
|
uses: docker/metadata-action@v4
|
2022-08-27 14:55:55 +00:00
|
|
|
with:
|
|
|
|
images: ghcr.io/sagernet/sing-box
|
|
|
|
- name: Get tag to build
|
|
|
|
id: tag
|
|
|
|
run: |
|
2022-10-29 10:01:11 +00:00
|
|
|
echo "latest=ghcr.io/sagernet/sing-box:latest" >> $GITHUB_OUTPUT
|
2022-08-27 14:55:55 +00:00
|
|
|
if [[ -z "${{ github.event.inputs.tag }}" ]]; then
|
2022-10-29 10:01:11 +00:00
|
|
|
echo "versioned=ghcr.io/sagernet/sing-box:${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
2022-08-27 14:55:55 +00:00
|
|
|
else
|
2022-10-29 10:01:11 +00:00
|
|
|
echo "versioned=ghcr.io/sagernet/sing-box:${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
|
2022-08-27 14:55:55 +00:00
|
|
|
fi
|
|
|
|
- name: Build and release Docker images
|
2023-02-09 09:42:06 +00:00
|
|
|
uses: docker/build-push-action@v4
|
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
|
2022-08-27 14:55:55 +00:00
|
|
|
target: dist
|
2022-10-29 10:01:11 +00:00
|
|
|
tags: |
|
|
|
|
${{ steps.tag.outputs.latest }}
|
|
|
|
${{ steps.tag.outputs.versioned }}
|
2022-10-26 11:29:27 +00:00
|
|
|
push: true
|