name: Build Docker Images on: push: tags: - v* workflow_dispatch: inputs: tag: description: "The tag version you want to build" jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Setup Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to GitHub Container Registry uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Docker metadata id: metadata uses: docker/metadata-action@v3 with: images: ghcr.io/sagernet/sing-box - name: Get tag to build id: tag run: | if [[ -z "${{ github.event.inputs.tag }}" ]]; then echo ::set-output name=tag::ghcr.io/sagernet/sing-box:${{ github.ref_name }} else echo ::set-output name=tag::ghcr.io/sagernet/sing-box:${{ github.event.inputs.tag }} fi - name: Build and release Docker images uses: docker/build-push-action@v2 with: platforms: linux/386,linux/amd64 target: dist tags: ${{ steps.tag.outputs.tag }} push: true