name: Docker Release on: push: tags: - "v*" workflow_dispatch: inputs: publish: description: "Push image to GHCR" required: false default: false type: boolean image_name: description: "GHCR image name (without ghcr.io/), default: owner/masterhttprelayvpn" required: false type: string permissions: contents: read packages: write jobs: docker-multiarch: name: Build Docker amd64+arm64 runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true') steps: - name: Checkout uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Resolve image and tags id: meta shell: bash run: | set -euo pipefail owner=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') if [ -n "${{ github.event.inputs.image_name || '' }}" ]; then image="ghcr.io/${{ github.event.inputs.image_name }}" else image="ghcr.io/${owner}/masterhttprelayvpn" fi if [ "${{ github.event_name }}" = "push" ]; then tag="${{ github.ref_name }}" else tag="manual-${{ github.run_number }}" fi { echo "image=$image" echo "tag=$tag" } >> "$GITHUB_OUTPUT" - name: Build and push image uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: | ${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.tag }} ${{ steps.meta.outputs.image }}:latest