fix: switch to the docker/github-builder reusable action

This commit is contained in:
tcely
2026-03-28 18:50:24 -04:00
parent dd0d1a8fd6
commit 4502713e21

View File

@@ -2,6 +2,7 @@ name: Release TubeSync
env: env:
IMAGE_NAME: tubesync IMAGE_NAME: tubesync
REGISTRY: ghcr.io
on: on:
release: release:
@@ -11,14 +12,16 @@ jobs:
info: info:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
ffmpeg-date: ${{ steps.jq.outputs.FFMPEG_DATE }} IMAGE_NAME: ${{ env.IMAGE_NAME }}
ffmpeg-releases: ${{ steps.ffmpeg.outputs.releases }} REGISTRY: ${{ env.REGISTRY }}
ffmpeg-version: ${{ steps.jq.outputs.FFMPEG_VERSION }} ffmpeg-date: ${{ steps.ffmpeg.outputs.date }}
# ffmpeg-releases: ${{ steps.ffmpeg.outputs.releases }}
ffmpeg-version: ${{ steps.ffmpeg.outputs.version }}
lowercase-github-actor: ${{ steps.github-actor.outputs.lowercase }} lowercase-github-actor: ${{ steps.github-actor.outputs.lowercase }}
lowercase-github-repository_owner: ${{ steps.github-repository_owner.outputs.lowercase }} lowercase-github-repository_owner: ${{ steps.github-repository_owner.outputs.lowercase }}
tag: ${{ steps.tag.outputs.tag }} tag: ${{ steps.tag.outputs.tag }}
ytdlp-latest-release: ${{ steps.yt-dlp.outputs.latest-release }} ytdlp-latest-release: ${{ steps.yt-dlp.outputs.latest-release }}
ytdlp-releases: ${{ steps.yt-dlp.outputs.releases }} # ytdlp-releases: ${{ steps.yt-dlp.outputs.releases }}
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- name: Get tag - name: Get tag
@@ -40,61 +43,36 @@ jobs:
- name: Retrieve yt-dlp/yt-dlp releases with GitHub CLI - name: Retrieve yt-dlp/yt-dlp releases with GitHub CLI
id: yt-dlp id: yt-dlp
uses: ./.github/actions/yt-dlp uses: ./.github/actions/yt-dlp
- name: Set outputs with jq
id: jq
run: |
cat >| .ffmpeg.releases.json <<'EOF'
${{ steps.ffmpeg.outputs.releases }}
EOF
mk_delim() { local f='%s_EOF_%d_' ; printf -- "${f}" "$1" "${RANDOM}" ; } ;
open_ml_var() { local f=''\%'s<<'\%'s\n' ; printf -- "${f}" "$2" "$1" ; } ;
close_ml_var() { local f='%s\n' ; printf -- "${f}" "$1" ; } ;
{
var='FFMPEG_DATE' ;
delim="$(mk_delim "${var}")" ;
open_ml_var "${delim}" "${var}" ;
jq_arg='[foreach .[] as $release ([{}, []]; [ .[0] + {($release.commit): ([ $release.date ] + (.[0][($release.commit)] // []) ) }, [ .[1][0] // $release.commit ] ] ; .[0][(.[1][0])] ) ][-1][0]' ;
jq -r "${jq_arg}" -- .ffmpeg.releases.json ;
close_ml_var "${delim}" "${var}" ;
ffmpeg_date="$( jq -r "${jq_arg}" -- .ffmpeg.releases.json )" docker-image:
concurrency:
var='FFMPEG_VERSION' ; group: ${{ github.repository }}-${{ github.workflow }}
delim="$(mk_delim "${var}")" ; cancel-in-progress: false
open_ml_var "${delim}" "${var}" ;
jq_arg='.[]|select(.date == $date)|.versions[]|select(startswith("N-"))' ;
jq -r --arg date "${ffmpeg_date}" "${jq_arg}" -- .ffmpeg.releases.json ;
close_ml_var "${delim}" "${var}" ;
unset -v delim jq_arg var ;
} >> "${GITHUB_OUTPUT}"
cat -v "${GITHUB_OUTPUT}"
rm -v -f .ffmpeg.releases.json
containerise:
needs: ['info'] needs: ['info']
runs-on: ubuntu-latest uses: docker/github-builder/.github/workflows/build.yml@v1
steps: permissions:
- name: Set up QEMU contents: read # to fetch the repository content
uses: docker/setup-qemu-action@v3 id-token: write # for signing attestation(s) with GitHub OIDC Token
- name: Set up Docker Buildx secrets:
uses: docker/setup-buildx-action@v3 registry-auths: |
- name: Log into GitHub Container Registry - registry: ${{ needs.info.outputs.REGISTRY }}
env: username: ${{ github.repository_owner }}
DOCKER_REGISTRY: https://ghcr.io password: ${{ 'meeb' == github.repository_owner && secrets.REGISTRY_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ github.repository_owner }} with:
DOCKER_TOKEN: ${{ 'meeb' == github.repository_owner && secrets.REGISTRY_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} cache: false
run: echo "${DOCKER_TOKEN}" | docker login --password-stdin --username "${DOCKER_USERNAME}" "${DOCKER_REGISTRY}" # cache-mode: max
- name: Build and push meta-images: ${{ needs.info.outputs.REGISTRY }}/${{ needs.info.outputs.lowercase-github-repository_owner }}/${{ needs.info.outputs.IMAGE_NAME }}
uses: docker/build-push-action@v6 output: image
with: platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64 push: true
push: true setup-qemu: false
tags: ghcr.io/${{ needs.info.outputs.lowercase-github-repository_owner }}/${{ env.IMAGE_NAME }}:${{ needs.info.outputs.tag }} meta-flavor: |
cache-from: | latest=false
type=registry,ref=ghcr.io/${{ needs.info.outputs.lowercase-github-repository_owner }}/${{ env.IMAGE_NAME }}:latest meta-tags: |
type=gha type=raw,value=${{ needs.info.outputs.tag }}
build-args: | type=ref,enable=false,event=tag
IMAGE_NAME=${{ env.IMAGE_NAME }} build-args: |
FFMPEG_DATE=${{ needs.info.outputs.ffmpeg-date }} IMAGE_NAME=${{ needs.info.outputs.IMAGE_NAME }}
FFMPEG_VERSION=${{ needs.info.outputs.ffmpeg-version }} FFMPEG_DATE=${{ needs.info.outputs.ffmpeg-date }}
YTDLP_DATE=${{ fromJSON(needs.info.outputs.ytdlp-latest-release).tag.name }} FFMPEG_VERSION=${{ needs.info.outputs.ffmpeg-version }}
YTDLP_DATE=${{ fromJSON(needs.info.outputs.ytdlp-latest-release).tag.name }}