ci: docker-build #1
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 and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| build-and-push: | |
| 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 Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: MSKNET | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| platforms: linux/amd64 | |
| tags: | | |
| ghcr.io/msknet/syncplay:v${{ steps.get-version.outputs.syncplay_version }} | |
| ghcr.io/msknet/syncplay:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |