Fix #1365: switch to tag-based trigger
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f98fbe2..0ac060c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -18,8 +18,9 @@
 name: release
 
 on:
-  schedule:
-  - cron:  '0 0 * * *'
+  push:
+    tags:
+      - '*nightly*'
 
 jobs:
   release:
@@ -50,7 +51,7 @@
         TEST_DOCKER_HUB_USERNAME: ${{ secrets.TEST_DOCKER_HUB_USERNAME }}
         TEST_DOCKER_HUB_PASSWORD: ${{ secrets.TEST_DOCKER_HUB_PASSWORD }}
       run: |
-        VERSION=$(make get-version | sed s/-SNAPSHOT/-nightly.$(date +%Y%m%d%H%M)/)
+        VERSION=${GITHUB_REF##*/}
         echo "Using VERSION=$VERSION"
         echo "::set-env name=VERSION::$VERSION"
 
@@ -62,22 +63,12 @@
         echo "Using MAVEN_REPOSITORY=$MAVEN_REPOSITORY"
         echo "::set-env name=MAVEN_REPOSITORY::$MAVEN_REPOSITORY"
 
-        # GITHUB_REF is not automatically set for cron-based actions
-        GITHUB_REF=refs/heads/master
-        echo "Using GITHUB_REF=$GITHUB_REF"
-        echo "::set-env name=GITHUB_REF::$GITHUB_REF"
-
         docker login -u $TEST_DOCKER_HUB_USERNAME -p $TEST_DOCKER_HUB_PASSWORD
 
     - name: Codegen
       run: |
         make VERSION=$VERSION IMAGE_NAME=$IMAGE_NAME codegen set-version build-resources
 
-    - name: Tag version
-      uses: anothrNick/github-tag-action@1.19.0
-      env:
-        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        CUSTOM_TAG: ${{ env.VERSION }}
     - name: Build
       run: |
         make VERSION=$VERSION IMAGE_NAME=$IMAGE_NAME release-nightly
diff --git a/script/trigger_nightly_build.sh b/script/trigger_nightly_build.sh
new file mode 100755
index 0000000..4f5ec9f
--- /dev/null
+++ b/script/trigger_nightly_build.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+V=$(make get-version | sed s/-SNAPSHOT/-nightly.$(date +%Y%m%d%H%M)/)
+git tag $V
+git push upstream $V