From b8b0def111e2756e87b5852677e1f4ecd5b25e10 Mon Sep 17 00:00:00 2001
From: Griefed <griefed@griefed.de>
Date: Thu, 25 Mar 2021 12:28:48 +0100
Subject: [PATCH] ci: Create new workflow for automated building, tagging,
 releasing

---
 .github/workflows/ci-publish-tag-releas.yml | 66 +++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 .github/workflows/ci-publish-tag-releas.yml

diff --git a/.github/workflows/ci-publish-tag-releas.yml b/.github/workflows/ci-publish-tag-releas.yml
new file mode 100644
index 0000000..7102fcd
--- /dev/null
+++ b/.github/workflows/ci-publish-tag-releas.yml
@@ -0,0 +1,66 @@
+name: ci-publish-tag
+
+on:
+  workflow_dispatch:
+
+jobs:
+  multi-registries:
+    runs-on: ubuntu-latest
+    steps:
+      # SETUP ENVIRONMENT
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v1
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v1
+      # GENERATE CHANGELOG, TAG, RELEASE
+      - id: conventional_changelog
+        uses: ardalanamini/auto-changelog@master
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
+      - id: compute_tag
+        uses: craig-day/compute-tag@v11
+        with:
+          github_token: ${{ secrets.GITHUB_TOKEN }}
+          version_scheme: semantic
+          version_type: patch
+          # MAJOR.MINOR.PATCH
+      - name: Create Release
+        id: create_release
+        uses: actions/create-release@latest
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          tag_name: ${{ steps.compute_tag.outputs.next_tag }}
+          release_name: "App-Collection"
+          body: |
+            Automatic release of version: **${{ steps.compute_tag.outputs.next_tag }}**
+            **Changes in this release:**
+            ${{ steps.conventional_changelog.outputs.changelog }}
+          draft: false
+          prerelease: false
+      # DOCKER RELATED
+      - name: Login to DockerHub
+        uses: docker/login-action@v1
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+      - name: Login to GitHub Container Registry
+        uses: docker/login-action@v1
+        with:
+          registry: ghcr.io
+          username: ${{ github.repository_owner }}
+          password: ${{ secrets.CR_PAT }}
+      - name: Build and push
+        uses: docker/build-push-action@v2
+        with:
+          context: .
+          file: ./Dockerfile
+          platforms: linux/amd64,linux/arm/v7,linux/arm64
+          push: true
+          tags: |
+            ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:latest
+            ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:latest
+            ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ steps.compute_tag.outputs.next_tag }}
+            ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ steps.compute_tag.outputs.next_tag }}
-- 
GitLab