From 53752487b62e97cac3de6ea47f51c6db050b741d Mon Sep 17 00:00:00 2001
From: Yoav Rotem <yoavrotems97@gmail.com>
Date: Mon, 14 Jun 2021 12:13:48 +0300
Subject: [PATCH] Add git config user (#901)

* Add git config user

* Create mkdocs-deploy.yaml

* Delete mkdocs-latest.yaml

* Delete mkdocs-dev.yaml
---
 .github/workflows/mkdocs-deploy.yaml | 36 ++++++++++++++++++++++++++++
 .github/workflows/mkdocs-dev.yaml    | 35 ---------------------------
 .github/workflows/mkdocs-latest.yaml | 30 -----------------------
 3 files changed, 36 insertions(+), 65 deletions(-)
 create mode 100644 .github/workflows/mkdocs-deploy.yaml
 delete mode 100644 .github/workflows/mkdocs-dev.yaml
 delete mode 100644 .github/workflows/mkdocs-latest.yaml

diff --git a/.github/workflows/mkdocs-deploy.yaml b/.github/workflows/mkdocs-deploy.yaml
new file mode 100644
index 0000000..312904a
--- /dev/null
+++ b/.github/workflows/mkdocs-deploy.yaml
@@ -0,0 +1,36 @@
+# This is a manually triggered workflow to build and publish the MkDocs from the
+# main branch to GitHub pages at https://aquasecurity.github.io/kube-bench.
+name: Deploy documentation
+
+on:
+  workflow_dispatch:
+    inputs:
+      version:
+        description: Version to be deployed
+        required: true
+
+jobs:
+  deploy:
+    name: Deploy documentation
+    runs-on: ubuntu-18.04
+    steps:
+      - name: Checkout main
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+          persist-credentials: true
+      - uses: actions/setup-python@v2
+        with:
+          python-version: 3.x
+      - run: |
+          pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
+          pip install mike
+          pip install mkdocs-macros-plugin
+        env:
+          # Note: It is not the same as ${{ secrets.GITHUB_TOKEN }} !
+          GH_TOKEN: ${{ secrets.MKDOCS_AQUA_BOT }}
+      - run: |
+          git config user.name "aqua-bot"
+          git config user.email "aqua-bot@users.noreply.github.com"
+      - run: |
+          mike deploy --push --update-aliases ${{ github.event.inputs.version }} latest
diff --git a/.github/workflows/mkdocs-dev.yaml b/.github/workflows/mkdocs-dev.yaml
deleted file mode 100644
index 4148be2..0000000
--- a/.github/workflows/mkdocs-dev.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
----
-name: Deploy the dev documentation
-on:
-  push:
-    paths:
-      - 'docs/**'
-      - mkdocs.yml
-    branches:
-      - main
-jobs:
-  deploy:
-    name: Deploy the dev documentation
-    runs-on: ubuntu-18.04
-    steps:
-      - name: Checkout main
-        uses: actions/checkout@v2
-        with:
-          fetch-depth: 0
-          persist-credentials: true
-      - uses: actions/setup-python@v2
-        with:
-          python-version: 3.x
-      - name: Install dependencies
-        run: |
-          pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
-          pip install mike
-          pip install mkdocs-macros-plugin
-        env:
-          GH_TOKEN: ${{ secrets.MKDOCS_AQUA_BOT }}
-      - name: Setup Git
-        run: |
-          git config user.name "github-actions"
-          git config user.email "github-actions@github.com"
-      - name: Deploy the dev documents
-        run: mike deploy --push dev
diff --git a/.github/workflows/mkdocs-latest.yaml b/.github/workflows/mkdocs-latest.yaml
deleted file mode 100644
index 0ca1762..0000000
--- a/.github/workflows/mkdocs-latest.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-name: Deploy the latest documentation
-on:
-  push:
-    tags:
-      - "v*"
-jobs:
-  deploy:
-    name: Deploy the latest documentation
-    runs-on: ubuntu-18.04
-    steps:
-      - name: Checkout main
-        uses: actions/checkout@v2
-        with:
-          fetch-depth: 0
-          persist-credentials: true
-      - uses: actions/setup-python@v2
-        with:
-          python-version: 3.x
-      - name: Install dependencies
-        run: |
-          pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
-          pip install mike
-          pip install mkdocs-macros-plugin
-        env:
-          GH_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }}
-      - name: Deploy the latest documents
-        run: |
-          VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
-          mike deploy --push --update-aliases $VERSION latest
-- 
GitLab