From c9ef312cf8adc9cf96f147b985801e3a31202416 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Sat, 5 Apr 2025 17:49:58 +0800 Subject: [PATCH] build: publish image of latest version --- .github/workflows/publish-latest-version.yml | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/publish-latest-version.yml diff --git a/.github/workflows/publish-latest-version.yml b/.github/workflows/publish-latest-version.yml new file mode 100644 index 0000000..47d10b6 --- /dev/null +++ b/.github/workflows/publish-latest-version.yml @@ -0,0 +1,53 @@ +name: Publish Latest Version + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +jobs: + publish-latest-version: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Extract Syncplay Version from Dockerfile + id: get-version + run: | + syncplay_version=$(grep -oP '(?<=ENV SYNCPLAY=")[^"]+' Dockerfile) + echo "syncplay_version=${syncplay_version}" + echo "syncplay_version=${syncplay_version}" >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GitHub Package Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7 + tags: | + ${{ vars.DOCKER_IMAGE }}:v${{ steps.get-version.outputs.syncplay_version }} + ghcr.io/${{ vars.DOCKER_IMAGE }}:v${{ steps.get-version.outputs.syncplay_version }} + push: true + cache-from: type=gha + cache-to: type=gha,mode=max