github.com/sagernet/sing-box@v1.9.0-rc.20/.github/workflows/docker.yml (about)

     1  name: Build Docker Images
     2  
     3  on:
     4    release:
     5      types:
     6        - released
     7    workflow_dispatch:
     8      inputs:
     9        tag:
    10          description: "The tag version you want to build"
    11  jobs:
    12    build:
    13      runs-on: ubuntu-latest
    14      steps:
    15        - name: Get commit to build
    16          id: ref
    17          run: |-
    18            if [[ -z "${{ github.event.inputs.tag }}" ]]; then
    19              ref="${{ github.ref_name }}"
    20            else
    21              ref="${{ github.event.inputs.tag }}"
    22            fi
    23            echo "ref=$ref"
    24            echo "ref=$ref" >> $GITHUB_OUTPUT
    25            if [[ $ref == *"-"* ]]; then
    26              latest=latest-beta
    27            else
    28              latest=latest
    29            fi
    30            echo "latest=$latest"
    31            echo "latest=$latest" >> $GITHUB_OUTPUT
    32        - name: Checkout
    33          uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
    34          with:
    35            ref: ${{ steps.ref.outputs.ref }}
    36        - name: Setup Docker Buildx
    37          uses: docker/setup-buildx-action@v3
    38        - name: Setup QEMU for Docker Buildx
    39          uses: docker/setup-qemu-action@v3
    40        - name: Login to GitHub Container Registry
    41          uses: docker/login-action@v3
    42          with:
    43            registry: ghcr.io
    44            username: ${{ github.repository_owner }}
    45            password: ${{ secrets.GITHUB_TOKEN }}
    46        - name: Docker metadata
    47          id: metadata
    48          uses: docker/metadata-action@v5
    49          with:
    50            images: ghcr.io/sagernet/sing-box
    51        - name: Build and release Docker images
    52          uses: docker/build-push-action@v5
    53          with:
    54            platforms: linux/386,linux/amd64,linux/arm64,linux/s390x
    55            context: .
    56            target: dist
    57            build-args: |
    58              BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
    59            tags: |
    60              ghcr.io/sagernet/sing-box:${{ steps.ref.outputs.latest }}
    61              ghcr.io/sagernet/sing-box:${{ steps.ref.outputs.ref }}
    62            push: true