Don't automatically try to push a 'latest' or 'classic' tag - to be fixed in a follow up PR.
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
|
||||
# When a tag is created.
|
||||
# Tag pattern: '[tag]' & '[tag]-classic'
|
||||
# 'latest' & 'classic' also, when master tagged.
|
||||
|
||||
# TODO: Does not currently push 'latest' or 'classic' tags.
|
||||
|
||||
# Builds but does not push a docker image for PRs.
|
||||
|
||||
@@ -40,12 +41,12 @@ jobs:
|
||||
dockerfile: ./docker/classic/Dockerfile
|
||||
tag_suffix: -classic
|
||||
build_args: |
|
||||
SHAIRPORT_SYNC_BRANCH=${{ needs.docker-vars.outputs.shairport_sync_branch }}
|
||||
SHAIRPORT_SYNC_BRANCH=.
|
||||
- name: main
|
||||
dockerfile: ./docker/Dockerfile
|
||||
tag_suffix: ""
|
||||
build_args: |
|
||||
SHAIRPORT_SYNC_BRANCH=${{ needs.docker-vars.outputs.shairport_sync_branch }}
|
||||
SHAIRPORT_SYNC_BRANCH=.
|
||||
NQPTP_BRANCH=${{ needs.docker-vars.outputs.nqptp_branch }}
|
||||
|
||||
steps:
|
||||
@@ -72,17 +73,23 @@ jobs:
|
||||
uses: docker/build-push-action@v6.13.0
|
||||
env:
|
||||
registry_and_name: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_IMAGE_NAME }}
|
||||
is_tag: ${{ github.ref_type == 'tag' }}
|
||||
branch_name: ${{ needs.docker-vars.outputs.shairport_sync_branch }}
|
||||
with:
|
||||
context: ./
|
||||
file: ${{ matrix.dockerfile }}
|
||||
platforms: ${{ needs.docker-vars.outputs.docker_platforms }}
|
||||
push: ${{ needs.docker-vars.outputs.push_docker_image == 'true' }}
|
||||
# Assign tags based on branch or tag type for clarity
|
||||
tags: |
|
||||
${{ env.branch_name == 'development' && format('{0}:development{1}', env.registry_and_name, matrix.tag_suffix) || '' }}
|
||||
${{ env.branch_name == 'master' && format('{0}:rolling{1}', env.registry_and_name, matrix.tag_suffix) || '' }}
|
||||
${{ env.is_tag == 'true' && format('{0}:{1}{2}', env.registry_and_name, github.ref_name, matrix.tag_suffix) || '' }}
|
||||
${{ env.is_tag == 'true' && env.branch_name == 'master' && format('{0}:latest{1}', env.registry_and_name, matrix.tag_suffix) || '' }}
|
||||
${{ github.ref_type == 'branch' && github.ref_name == 'development'
|
||||
&& format('{0}:development{1}', env.registry_and_name, matrix.tag_suffix) || '' }}
|
||||
|
||||
${{ github.ref_type == 'branch' && github.ref_name == 'master'
|
||||
&& format('{0}:rolling{1}', env.registry_and_name, matrix.tag_suffix) || '' }}
|
||||
|
||||
${{ github.ref_type == 'tag'
|
||||
&& format('{0}:{1}{2}', env.registry_and_name, github.ref_name, matrix.tag_suffix) || '' }}
|
||||
build-args: |
|
||||
${{ matrix.build_args }}
|
||||
${{ matrix.build_args }}
|
||||
|
||||
# TODO: Fix pushing of 'latest' and 'classic' tags.
|
||||
# env.is_tag == 'true' && env.branch_name == 'master' && format('{0}:latest{1}', env.registry_and_name, matrix.tag_suffix) || ''
|
||||
@@ -1,9 +1,6 @@
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
shairport_sync_branch:
|
||||
description: "The SPS branch."
|
||||
value: ${{ jobs.docker-vars.outputs.shairport_sync_branch }}
|
||||
docker_platforms:
|
||||
description: "The docker platforms to build for."
|
||||
value: ${{ jobs.docker-vars.outputs.docker_platforms }}
|
||||
@@ -19,20 +16,13 @@ jobs:
|
||||
name: Set variables required for docker build.
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
SHAIRPORT_SYNC_BRANCH: ""
|
||||
NQPTP_BRANCH: main
|
||||
PUSH_DOCKER_IMAGE: "false"
|
||||
outputs:
|
||||
shairport_sync_branch: ${{ env.SHAIRPORT_SYNC_BRANCH }}
|
||||
nqptp_branch: ${{ env.NQPTP_BRANCH }}
|
||||
push_docker_image: ${{ env.PUSH_DOCKER_IMAGE }}
|
||||
docker_platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
||||
steps:
|
||||
- name: Set shairport_sync_branch to branch name.
|
||||
id: set-branch
|
||||
run: |
|
||||
echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Push docker image if this is a tag.
|
||||
if: github.ref_type == 'tag'
|
||||
run: |
|
||||
@@ -42,13 +32,15 @@ jobs:
|
||||
if: |
|
||||
github.ref_type == 'branch' &&
|
||||
(
|
||||
env.SHAIRPORT_SYNC_BRANCH == 'master' ||
|
||||
env.SHAIRPORT_SYNC_BRANCH == 'development'
|
||||
github.ref_name == 'master' ||
|
||||
github.ref_name == 'development'
|
||||
)
|
||||
run: |
|
||||
echo "PUSH_DOCKER_IMAGE=true" >> "$GITHUB_ENV"
|
||||
|
||||
- name: If 'development' branch, set NQPTP_BRANCH to 'development'.
|
||||
if: env.SHAIRPORT_SYNC_BRANCH == 'development'
|
||||
if: |
|
||||
github.ref_type == 'branch' &&
|
||||
github.ref_name == 'development'
|
||||
run: |
|
||||
echo "NQPTP_BRANCH=development" >> "$GITHUB_ENV"
|
||||
echo "NQPTP_BRANCH=development" >> "$GITHUB_ENV"
|
||||
Reference in New Issue
Block a user