You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
5 months ago
|
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
|