Add docker.yaml to master branch
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
# Builds & pushes a docker image when a tag is created.
|
||||
# Tag pattern: '[tag]' & '[tag]-classic'
|
||||
# 'latest' & 'classic' also, when master tagged.
|
||||
|
||||
# Only pushes the tag when it matches one of the following patterns:
|
||||
# X, X.Y or X.Y.Z
|
||||
|
||||
name: Build and push Docker images...
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- '[0-9]+' # X
|
||||
- '[0-9]+\.[0-9]+' # X.Y
|
||||
- '[0-9]+\.[0-9]+\.[0-9]+' # X.Y.Z
|
||||
|
||||
env:
|
||||
DOCKER_PLATFORMS: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
||||
NQPTP_BRANCH: main
|
||||
LATEST_TAG: false
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set SHAIRPORT_SYNC_BRANCH env.
|
||||
run: |
|
||||
raw=$(git branch -r --contains ${{ github.ref }})
|
||||
branch=${raw##*/}
|
||||
echo "SHAIRPORT_SYNC_BRANCH=${branch}" >> $GITHUB_ENV
|
||||
|
||||
- name: Set tag env
|
||||
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Is branch "development"?
|
||||
if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }}
|
||||
run: |
|
||||
echo "NQPTP_BRANCH=development" >> $GITHUB_ENV
|
||||
|
||||
- name: Is branch "danger-2301"?
|
||||
if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'danger-2301' }}
|
||||
run: |
|
||||
echo "NQPTP_BRANCH=development" >> $GITHUB_ENV
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3.6.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3.10.0
|
||||
|
||||
- name: Login to Docker Registry
|
||||
uses: docker/login-action@v3.4.0
|
||||
with:
|
||||
# registry: docker.io # default
|
||||
username: ${{ secrets.DOCKER_REGISTRY_USER }}
|
||||
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and push (classic)
|
||||
uses: docker/build-push-action@v6.15.0
|
||||
with:
|
||||
context: ./
|
||||
file: ./docker/classic/Dockerfile
|
||||
platforms: ${{ env.DOCKER_PLATFORMS }}
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKER_IMAGE_NAME }}:${{ env.GIT_TAG }}-classic
|
||||
${{ env.LATEST_TAG == 'true' && format('{0}:classic', secrets.DOCKER_IMAGE_NAME) || '' }}
|
||||
build-args: |
|
||||
SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }}
|
||||
|
||||
- name: Build and Push AirPlay 2 Version
|
||||
uses: docker/build-push-action@v6.15.0
|
||||
with:
|
||||
context: ./
|
||||
file: ./docker/Dockerfile
|
||||
platforms: ${{ env.DOCKER_PLATFORMS }}
|
||||
push: true
|
||||
tags: |
|
||||
mikebrady/sps-private:${{ env.GIT_TAG }}
|
||||
mikebrady/sps-private:latest
|
||||
build-args: |
|
||||
SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }}
|
||||
NQPTP_BRANCH=${{ env.NQPTP_BRANCH }}
|
||||
Reference in New Issue
Block a user