]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Add docker-build-on-formal-release.yaml and stale.yaml to the branch.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Thu, 29 Sep 2022 11:46:05 +0000 (12:46 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Thu, 29 Sep 2022 11:46:05 +0000 (12:46 +0100)
.github/workflows/docker-build-on-formal-release.yaml [new file with mode: 0644]
.github/workflows/stale.yaml [new file with mode: 0644]

diff --git a/.github/workflows/docker-build-on-formal-release.yaml b/.github/workflows/docker-build-on-formal-release.yaml
new file mode 100644 (file)
index 0000000..fc69837
--- /dev/null
@@ -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:
+    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 }}
diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml
new file mode 100644 (file)
index 0000000..51658c0
--- /dev/null
@@ -0,0 +1,21 @@
+name: 'Close stale issues and PRs'
+on:
+  schedule:
+    - cron: '0 0 * * *'
+
+permissions:
+  issues: write
+  pull-requests: write
+
+jobs:
+  stale:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/stale@v4
+        with:
+          stale-issue-message: 'This issue has been inactive for 45 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.'
+          stale-pr-message: 'This PR has been inactive for 45 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.'
+          operations-per-run: 100
+          # These are the defaults at the time of writing. https://github.com/marketplace/actions/close-stale-issues
+          # days-before-stale: 45
+          # days-before-close: 7