Build sing-box image #309
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build sing-box image | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| paths: | |
| - 'sing-box/**' | |
| - '.github/workflows/build-sing-box.yml' | |
| schedule: | |
| - cron: '11 0 * * *' | |
| jobs: | |
| build-sing-box: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.2.2 | |
| - name: Get latest release | |
| id: sing-box | |
| uses: pozetroninc/github-action-get-latest-release@v0.8.0 | |
| with: | |
| owner: SagerNet | |
| repo: sing-box | |
| excludes: prerelease, draft | |
| - name: Check image | |
| id: image_exists | |
| continue-on-error: true | |
| uses: cloudposse/github-action-docker-image-exists@0.2.0 | |
| with: | |
| registry: registry.hub.docker.com | |
| organization: "itdoginfo" | |
| repository: "sing-box" | |
| tag: ${{ steps.sing-box.outputs.release }} | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3.4.0 | |
| if: always() && steps.image_exists.outcome == 'failure' | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3.6.0 | |
| if: always() && steps.image_exists.outcome == 'failure' | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3.11.1 | |
| if: always() && steps.image_exists.outcome == 'failure' | |
| - name: Build and push sing-box | |
| uses: docker/build-push-action@v6.18.0 | |
| if: always() && steps.image_exists.outcome == 'failure' | |
| with: | |
| context: ./sing-box | |
| push: true | |
| build-args: RELEASE=${{ steps.sing-box.outputs.release }} | |
| tags: itdoginfo/sing-box:${{ steps.sing-box.outputs.release }} | |
| platforms: linux/amd64, linux/arm64, linux/s390x |