Skip to content

Commit 1dbb5c4

Browse files
authored
Merge pull request dnomd343#3 from Misaka13514/master
ci: add workflow
2 parents 11b4357 + a0a5284 commit 1dbb5c4

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Extract Syncplay version from Dockerfile
21+
id: get-version
22+
run: |
23+
syncplay_version=$(grep -oP '(?<=ENV SYNCPLAY=")[^"]+' Dockerfile)
24+
echo "syncplay_version=${syncplay_version}"
25+
echo "syncplay_version=${syncplay_version}" >> $GITHUB_OUTPUT
26+
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v3
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Login to Docker Hub
34+
if: github.event_name != 'pull_request'
35+
uses: docker/login-action@v3
36+
with:
37+
username: ${{ secrets.DOCKERHUB_USERNAME }}
38+
password: ${{ secrets.DOCKERHUB_TOKEN }}
39+
40+
- name: Build and push
41+
uses: docker/build-push-action@v5
42+
with:
43+
context: .
44+
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7
45+
push: ${{ github.event_name != 'pull_request' }}
46+
tags: |
47+
${{ secrets.DOCKER_IMAGE }}:v${{ steps.get-version.outputs.syncplay_version }}
48+
${{ secrets.DOCKER_IMAGE }}:latest
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)