]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Docker build changes, github action updates. 1549/head
authorCharles <32498151+charlesomer@users.noreply.github.com>
Wed, 5 Oct 2022 21:50:18 +0000 (22:50 +0100)
committerCharles <32498151+charlesomer@users.noreply.github.com>
Wed, 5 Oct 2022 21:50:18 +0000 (22:50 +0100)
.github/workflows/docker-build-on-formal-release.yaml [deleted file]
.github/workflows/docker-build-on-push.yaml
.github/workflows/docker-build-on-tag.yaml
docker/README.md
docker/docker-compose.yaml

diff --git a/.github/workflows/docker-build-on-formal-release.yaml b/.github/workflows/docker-build-on-formal-release.yaml
deleted file mode 100644 (file)
index fc69837..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-# Builds & pushes a docker image when a "formal" release tag of the format X, X.Y or X.Y.Z occurs, where X, Y and Z are all numbers.
-# It seems this yaml has to exist on the branch the tag refers to.
-
-# Thanks to Charles Omer for the workfow upon which this is based.
-
-# The following docker tags are created & pushed:
-# trial, trial-classic
-# not building 'latest' yet...
-
-name: Formal (X, X.Y or X.Y.Z) release tags -- docker build and push.
-
-on:
-  push:
-    tags:
-      - '[0-9]+\.[0-9]+\.[0-9]+'  # e.g. 8.9.0
-      - '[0-9]+\.[0-9]+'  # e.g. 8.9
-      - '[0-9]+'  # e.g. 8
-      - '[0-9]+\.[0-9]+rc[0-9]+' # e.g. 4.1rc0
-
-env:
-  DOCKER_PLATFORMS: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7
-
-jobs:
-  main:
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v2
-        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: Determine NQPTP env (part 1).
-        if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }}
-        run: echo "NQPTP_BRANCH=development" >> $GITHUB_ENV
-      
-      - name: Determine NQPTP env (part 2).
-        if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }}
-        run: echo "NQPTP_BRANCH=main" >> $GITHUB_ENV
-        
-      - name: Set up QEMU
-        uses: docker/setup-qemu-action@v1
-
-      - name: Set up Docker Buildx
-        uses: docker/setup-buildx-action@v1
-
-      - name: Login to Docker Registry
-        uses: docker/login-action@v1
-        with:
-          registry: ${{ secrets.DOCKER_REGISTRY }}
-          username: ${{ secrets.DOCKER_REGISTRY_USER }}
-          password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
-
-      - name: Build and push
-        uses: docker/build-push-action@v2
-        with:
-          context: ./
-          file: ./docker/Dockerfile
-          platforms: ${{ env.DOCKER_PLATFORMS }}
-          push: true
-          tags: trial
-          build-args: |
-            SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }}
-            NQPTP_BRANCH=${{ env.NQPTP_BRANCH }}
-
-      - name: Build and push (Classic)
-        uses: docker/build-push-action@v2
-        with:
-          context: ./
-          file: ./docker/classic/Dockerfile
-          platforms: ${{ env.DOCKER_PLATFORMS }}
-          push: true
-          tags: trial-classic
-          build-args: |
-            SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }}
index dca048e21dd0dab474f45ae781a0190accc2b876..1d273cad9284564188b45194247f91a3384e1fae 100644 (file)
@@ -1,14 +1,19 @@
-# Builds & pushes a docker image when a commit is made to one of the branches specified below.
-# Tag pattern: 'unstable-[BRANCH NAME]' & 'unstable-[BRANCH NAME]-classic'
+# Builds a docker image when a commit is made. Also pushes the build if the branch is 'master' or 'development'.
 
-name: Build and push docker image based on commit to specified branches.
+# Tag pattern
+# 'master'      - latest, latest-classic
+# 'development' - development, development-classic
+
+name: Build and push docker (commit)
 
 on:
   push:
-    branches: [ development ]
+    branches:
+      - '**'
 
 env:
   DOCKER_PLATFORMS: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
+  NQPTP_BRANCH: main
 
 jobs:
   main:
@@ -22,13 +27,16 @@ jobs:
       - name: Set SHAIRPORT_SYNC_BRANCH env.
         run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
 
-      - name: Determine NQPTP env (part 1).
-        if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }}
-        run: echo "NQPTP_BRANCH=development" >> $GITHUB_ENV
+      - name: Is branch "master"?
+        if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'master' }}
+        run: |
+          echo "IMAGE_TAG_BASE=latest" >> $GITHUB_ENV
 
-      - name: Determine NQPTP env (part 2).
-        if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }}
-        run: echo "NQPTP_BRANCH=main" >> $GITHUB_ENV
+      - name: Is branch "development"?
+        if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }}
+        run: |
+          echo "NQPTP_BRANCH=development" >> $GITHUB_ENV
+          echo "IMAGE_TAG_BASE=development" >> $GITHUB_ENV
 
       - name: Set up QEMU
         uses: docker/setup-qemu-action@v1
@@ -43,33 +51,25 @@ jobs:
           username: ${{ secrets.DOCKER_REGISTRY_USER }}
           password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
 
-      - name: Set tag start (part 1).
-        if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'master' }}
-        run: echo "IMAGE_TAG_BASE=unstable" >> $GITHUB_ENV
-
-      - name: Set tag start (part 2).
-        if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'master' }}
-        run: echo "IMAGE_TAG_BASE=unstable-${{ env.SHAIRPORT_SYNC_BRANCH }}" >> $GITHUB_ENV
-
       - name: Build and push
         uses: docker/build-push-action@v2
         with:
           context: ./
           file: ./docker/Dockerfile
           platforms: ${{ env.DOCKER_PLATFORMS }}
-          push: true
+          push: ${{ env.IMAGE_TAG_BASE != '' }}
           tags: ${{ secrets.DOCKER_IMAGE_NAME }}:${{ env.IMAGE_TAG_BASE }}
           build-args: |
             SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }}
             NQPTP_BRANCH=${{ env.NQPTP_BRANCH }}
 
-      - name: Build and push (AirPlay 1)
+      - name: Build and push (classic)
         uses: docker/build-push-action@v2
         with:
           context: ./
           file: ./docker/classic/Dockerfile
           platforms: ${{ env.DOCKER_PLATFORMS }}
-          push: true
+          push: ${{ env.IMAGE_TAG_BASE != '' }}
           tags: ${{ secrets.DOCKER_IMAGE_NAME }}:${{ env.IMAGE_TAG_BASE }}-classic
           build-args: |
             SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }}
\ No newline at end of file
index 6762a9bd0ca51c049d97f859e20923403c75e979..0e87ebd4d1fbad861958f5a12233ceff2d281278 100644 (file)
@@ -1,18 +1,22 @@
-# Builds & pushes a docker image when a tag occurs.
-# It seems this yaml has to exist on the branch the tag refers to.
+# Builds & pushes a docker image when a tag is created.
+# Tag pattern: '[tag]' & '[tag]-classic'
+# 'stable' & 'stable-classic' also, when master tagged.
 
-# The following docker tags are created & pushed:
-# [RELEASE TAG], [RELEASE TAG]-classic,
+# 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 releases.
+name: Build and push docker (tag)
 
 on:
   push:
     tags:
-      - '*' # Push events to every tag (not containing '/')
+      - '[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/arm64,linux/arm/v7
+  NQPTP_BRANCH: main
 
 jobs:
   main:
@@ -32,22 +36,23 @@ jobs:
       - name: Set tag env
         run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
 
-      - name: Determine NQPTP env (part 1).
+      - name: Is branch "master"?
+        if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'master' }}
+        run: echo "STABLE_TAG=true" >> $GITHUB_ENV
+
+      - name: Is branch "development"?
         if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }}
-        run: echo "NQPTP_BRANCH=development" >> $GITHUB_ENV
-      
-      - name: Determine NQPTP env (part 2).
-        if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }}
-        run: echo "NQPTP_BRANCH=main" >> $GITHUB_ENV
+        run: |
+          echo "NQPTP_BRANCH=development" >> $GITHUB_ENV
         
       - name: Set up QEMU
-        uses: docker/setup-qemu-action@v1
+        uses: docker/setup-qemu-action@v2
 
       - name: Set up Docker Buildx
-        uses: docker/setup-buildx-action@v1
+        uses: docker/setup-buildx-action@v2
 
       - name: Login to Docker Registry
-        uses: docker/login-action@v1
+        uses: docker/login-action@v2
         with:
           registry: ${{ secrets.DOCKER_REGISTRY }}
           username: ${{ secrets.DOCKER_REGISTRY_USER }}
@@ -60,18 +65,22 @@ jobs:
           file: ./docker/Dockerfile
           platforms: ${{ env.DOCKER_PLATFORMS }}
           push: true
-          tags: ${{ secrets.DOCKER_IMAGE_NAME }}:${{ env.GIT_TAG }}
+          tags: |
+            ${{ secrets.DOCKER_IMAGE_NAME }}:${{ env.GIT_TAG }}
+            ${{ env.STABLE_TAG == 'true' && format('{0}:stable', secrets.DOCKER_IMAGE_NAME) || '' }}
           build-args: |
             SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }}
             NQPTP_BRANCH=${{ env.NQPTP_BRANCH }}
 
-      - name: Build and push (Classic)
+      - name: Build and push (classic)
         uses: docker/build-push-action@v2
         with:
           context: ./
           file: ./docker/classic/Dockerfile
           platforms: ${{ env.DOCKER_PLATFORMS }}
           push: true
-          tags: ${{ secrets.DOCKER_IMAGE_NAME }}:${{ env.GIT_TAG }}-classic
+          tags: |
+            ${{ secrets.DOCKER_IMAGE_NAME }}:${{ env.GIT_TAG }}-classic
+            ${{ env.STABLE_TAG == 'true' && format('{0}:stable-classic', secrets.DOCKER_IMAGE_NAME) || '' }}
           build-args: |
             SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }}
\ No newline at end of file
index acabc1233afc45bd316347260d7b1f875a566062..2b27e77f9f2d03f75eab583f19508adc27d82d91 100644 (file)
@@ -2,21 +2,32 @@
 
 Available at: https://hub.docker.com/r/mikebrady/shairport-sync
 
-Please note if you want the development version of the image including Airplay 2 support, please pull the image with the ```unstable development``` tag using the following command:
-```
-docker pull mikebrady/shairport-sync:unstable-development
+The following docker tags are available:
 ```
+[tag]
+[tag]-classic
+
+(build from newest tag)
+stable
+stable-classic
 
-When using the below commands, you should replace mikebrady/shairport-sync with mikbrady/shairport-sync:unstable-development.
+(latest build from master)
+latest
+latest-classic
+
+(latest build from development)
+development
+development-classic
+```
 
 ## Example Docker Compose File
 See the `docker-compose.yaml` file in this folder for an example.
 
-## Docker Run
+## Example Docker Run
 
 ```
 $ docker run -d --restart unless-stopped --net host --device /dev/snd \
-    mikebrady/shairport-sync
+    mikebrady/shairport-sync:<tag>
 ```
 
 ### Options
@@ -24,7 +35,7 @@ $ docker run -d --restart unless-stopped --net host --device /dev/snd \
 You can change the default commands passed to Shairport Sync. Here is an example:
 ```
 $ docker run -d --restart unless-stopped --net host --device /dev/snd \
-    mikebrady/shairport-sync:unstable-development shairport-sync -v \
+    mikebrady/shairport-sync:<tag> shairport-sync -v \
     --statistics -a DenSystem -d hw:0 -c PCM
 ```
 This will sent audio to alsa hardware device `hw:0` and make use of the that device's mixer control called `PCM`. The service will be visible as `DenSystem` on the network.
@@ -53,4 +64,4 @@ Requires the following secrets to be set in the repo:
 - `DOCKER_REGISTRY` - docker.io if using Docker Hub, else set to your registry URL.
 - `DOCKER_REGISTRY_TOKEN` - Access token for your registry.
 - `DOCKER_REGISTRY_USER` - Login user for your registry.
-- `DOCKER_IMAGE_NAME` - The name of the image, for example `your-registry.com/shairport-sync` or just `your-username/shairport-sync` if using Docker Hub.
+- `DOCKER_IMAGE_NAME` - The name of the image, for example `your-registry.com/shairport-sync` or just `your-username/shairport-sync` if using Docker Hub.
\ No newline at end of file
index 13b5bac7a0277d7ea95485c876a643d389fb799d..6b2394a1b882842193ef5003e8d74b48fc2127e6 100644 (file)
@@ -2,7 +2,7 @@
 
 services:
   shairport-sync:
-    image: mikebrady/shairport-sync:unstable-development
+    image: mikebrady/shairport-sync:<tag>
     network_mode: host
     restart: unless-stopped
     devices: