Browse Source

ci: add workflow

pull/3/head
Misaka13514 5 months ago
parent
commit
a0a52847cf
No known key found for this signature in database GPG Key ID: 5BA92099D9BE2DAA
  1. 50
      .github/workflows/docker-build-push.yml

50
.github/workflows/docker-build-push.yml

@ -0,0 +1,50 @@
name: Build and Push Docker Image
on:
push:
branches:
- master
pull_request:
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 QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ secrets.DOCKER_IMAGE }}:v${{ steps.get-version.outputs.syncplay_version }}
${{ secrets.DOCKER_IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
Loading…
Cancel
Save