Misaka13514
5 months ago
1 changed files with 50 additions and 0 deletions
@ -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…
Reference in new issue