From 7368a367f4f61a0191865aad325886b259a71967 Mon Sep 17 00:00:00 2001 From: bipproduction Date: Mon, 2 Mar 2026 15:38:49 +0800 Subject: [PATCH] chore: tambah publish.yml workflow_dispatch ke main Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/publish.yml | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..12b09769 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,60 @@ +name: Publish Docker to GHCR +on: + workflow_dispatch: + inputs: + tag: + description: "Image tag (e.g. v1.0.0)" + required: true + default: "latest" +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} +jobs: + publish: + name: Build & Push to GHCR + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Free disk space + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + df -h + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Extract tag name + id: meta + run: echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + platforms: linux/amd64 + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tag }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max +