Browse Source

build: support publish latest image

master
Dnomd343 2 weeks ago
parent
commit
af942c4964
  1. 34
      .github/workflows/publish-latest.yml

34
.github/workflows/docker-build-push.yml → .github/workflows/publish-latest.yml

@ -1,26 +1,23 @@
name: Build and Push Docker Image name: Publish Latest Image
on: on:
push: push:
branches: branches:
- master - master
paths-ignore:
- 'docs/**'
- 'README.md'
- '.gitignore'
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build-and-push: publish-latest-image:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 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 - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
@ -30,17 +27,24 @@ jobs:
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ vars.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push - name: Login to GitHub Package Registry
uses: docker/build-push-action@v5 uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v6
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7
push: true
tags: | tags: |
${{ secrets.DOCKER_IMAGE }}:v${{ steps.get-version.outputs.syncplay_version }} ${{ vars.DOCKER_IMAGE }}:latest
${{ secrets.DOCKER_IMAGE }}:latest ghcr.io/${{ vars.DOCKER_IMAGE }}:latest
push: true
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
Loading…
Cancel
Save