From 8e4a3d34b570440eaabaacaf83686092f3f3d875 Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Thu, 18 Feb 2021 19:52:37 +0100
Subject: [PATCH] add release ci

---
 .github/workflows/release-ci.yml | 42 ++++++++++++++++++++++++++++++++
 .github/workflows/release.yml    | 21 ++++++++++++++++
 2 files changed, 63 insertions(+)
 create mode 100644 .github/workflows/release-ci.yml
 create mode 100644 .github/workflows/release.yml

diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml
new file mode 100644
index 000000000..b1a0c8800
--- /dev/null
+++ b/.github/workflows/release-ci.yml
@@ -0,0 +1,42 @@
+name: Release CI
+on:
+  pull_requests:
+    branches:
+    - master
+
+jobs:
+  check_version:
+    if: always()
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v1
+    - run: |
+        MASTER_VERSION=$(git show origin/master:package.json | jq '.version')
+        THIS_VERSION=$(jq '.version' < package.json)
+        test "$MASTER_VERSION" == "$THIS_VERSION" && exit 1 || exit 0
+
+  check_release:
+    if: always()
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v1
+    - run: |
+        VERSION_NUM=$(jq '.version' < package.json)
+        VERSION_NUM=${VERSION_NUM#\"}
+        VERSION_NUM=${VERSION_NUM%\"}
+        test -f docs/releases/v$VERSION_NUM.md && exit 0 || exit 1
+  
+  release_linked_mkdocs:
+    if: always()
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v1
+    - run: |
+        VERSION_NUM=$(jq '.version' < package.json)
+        VERSION_NUM=${VERSION_NUM#\"} 
+        VERSION_NUM=${VERSION_NUM%\"} 
+        'echo "VERSION_NUM: $VERSION_NUM"'
+        cat mkdocs.yml
+        GREP_VERSION_NUM=$(cat mkdocs.yml | grep $VERSION_NUM)
+        'echo GREP_VERSION_NUM: $GREP_VERSION_NUM'
+        test -z "$GREP_VERSION_NUM" && exit 1 || exit 0
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 000000000..b0bbee0f9
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,21 @@
+name: Release
+on:
+  push: 
+    branches:
+      - master
+
+jobs:
+  release:
+    runs-on: ubuntu-latest
+    steps:
+      - echo 'NYI'
+    # - name: Create Release
+    #   id: create_release
+    #   uses: actions/create-release@v1
+    #   env:
+    #     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+    #   with:
+    #     tag_name: ${{ github.ref }}
+    #     release_name: Release ${{ github.ref }}
+    #     draft: false
+    #     prerelease: false
\ No newline at end of file
-- 
GitLab