From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Wed, 28 Sep 2022 14:39:44 +0000 (+0100) Subject: Create docker-build-on-formal-release.yaml X-Git-Tag: 4.1-rc1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba94fc4c1202772daefd7a98ad8627f19dc233d1;p=thirdparty%2Fshairport-sync.git Create docker-build-on-formal-release.yaml --- diff --git a/.github/workflows/docker-build-on-formal-release.yaml b/.github/workflows/docker-build-on-formal-release.yaml new file mode 100644 index 00000000..1995ab79 --- /dev/null +++ b/.github/workflows/docker-build-on-formal-release.yaml @@ -0,0 +1,83 @@ +# 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 }}