--- /dev/null
+# 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:
+ branches: [ master ]
+ 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
+
+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 }}