From a0005be1289d89cdf59743c8cf4f1baf80210360 Mon Sep 17 00:00:00 2001 From: amitmiran137 Date: Fri, 22 Jan 2021 01:04:11 +0200 Subject: [PATCH 1/5] chore: the ideais to create a weekly(periodically) github release which will actually trigger on: release: types: [published] which will create a complete release cycle --- .github/workflows/scheduled_release.yml | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/scheduled_release.yml diff --git a/.github/workflows/scheduled_release.yml b/.github/workflows/scheduled_release.yml new file mode 100644 index 0000000000000..49895a4742cd9 --- /dev/null +++ b/.github/workflows/scheduled_release.yml @@ -0,0 +1,34 @@ +on: + + schedule: + - cron: '0 0 * * 2' # https://crontab.guru/#0_0_*_*_2 + +name: Create Release + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Get current date # following pair of steps taken from this example: https://stackoverflow.com/questions/60942067/get-current-date-and-time-in-github-workflows + id: date + run: echo "name=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + - name: Test with environment variables + run: echo $TAG_NAME - $RELEASE_NAME + env: + TAG_NAME: weekly-tag-${{ steps.date.outputs.date }} + RELEASE_NAME: weekly-release-${{ steps.date.outputs.date }} + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: weekly-tag-${{ steps.date.outputs.date }} + release_name: Reekly-release-${{ steps.date.outputs.date }} + body: | + ##todo: list of commits + draft: false + prerelease: false From 32ae64bd62dcf4006fda4169fb10eac25d6c4094 Mon Sep 17 00:00:00 2001 From: amitmiran137 Date: Fri, 22 Jan 2021 01:29:01 +0200 Subject: [PATCH 2/5] fix: I always like a nice pre-commit fix --- .github/workflows/scheduled_release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scheduled_release.yml b/.github/workflows/scheduled_release.yml index 49895a4742cd9..2ef82d832e938 100644 --- a/.github/workflows/scheduled_release.yml +++ b/.github/workflows/scheduled_release.yml @@ -12,9 +12,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - - name: Get current date # following pair of steps taken from this example: https://stackoverflow.com/questions/60942067/get-current-date-and-time-in-github-workflows - id: date - run: echo "name=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + - name: Get current date + id: date + run: echo "name=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - name: Test with environment variables run: echo $TAG_NAME - $RELEASE_NAME env: From 8839a2211d35edb33033695e03e2f4c04e21e3f3 Mon Sep 17 00:00:00 2001 From: amitmiran137 Date: Fri, 22 Jan 2021 08:35:58 +0200 Subject: [PATCH 3/5] fix: changes about CR --- .github/workflows/scheduled_release.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/scheduled_release.yml b/.github/workflows/scheduled_release.yml index 2ef82d832e938..ec78499479b98 100644 --- a/.github/workflows/scheduled_release.yml +++ b/.github/workflows/scheduled_release.yml @@ -1,7 +1,7 @@ on: schedule: - - cron: '0 0 * * 2' # https://crontab.guru/#0_0_*_*_2 + - cron: '0 0 * * 2' # Midnight on every Tuesday name: Create Release @@ -13,21 +13,15 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - name: Get current date - id: date - run: echo "name=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - - name: Test with environment variables - run: echo $TAG_NAME - $RELEASE_NAME - env: - TAG_NAME: weekly-tag-${{ steps.date.outputs.date }} - RELEASE_NAME: weekly-release-${{ steps.date.outputs.date }} + run: echo "::set-output name=todays_date::$(date +'%Y-%m-%d')" - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: weekly-tag-${{ steps.date.outputs.date }} - release_name: Reekly-release-${{ steps.date.outputs.date }} + tag_name: superset-1.0.0-${{ outputs.todays_date.value }} + release_name: superset-1.0.0-${{ outputs.todays_date.value }} body: | ##todo: list of commits draft: false From 2a298872d4e743cfa8e05e10df121d1d84ae81b4 Mon Sep 17 00:00:00 2001 From: amitmiran137 Date: Sat, 23 Jan 2021 22:03:33 +0200 Subject: [PATCH 4/5] feat: find_latest_tag_version.sh that echo the version number to be used in the scheduled_weekly_build.yml --- ...release.yml => scheduled_weekly_build.yml} | 10 ++-- scripts/find_latest_tag_version.sh | 49 +++++++++++++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) rename .github/workflows/{scheduled_release.yml => scheduled_weekly_build.yml} (56%) create mode 100755 scripts/find_latest_tag_version.sh diff --git a/.github/workflows/scheduled_release.yml b/.github/workflows/scheduled_weekly_build.yml similarity index 56% rename from .github/workflows/scheduled_release.yml rename to .github/workflows/scheduled_weekly_build.yml index ec78499479b98..b858a25b317d1 100644 --- a/.github/workflows/scheduled_release.yml +++ b/.github/workflows/scheduled_weekly_build.yml @@ -3,7 +3,7 @@ on: schedule: - cron: '0 0 * * 2' # Midnight on every Tuesday -name: Create Release +name: Scheduled weekly build jobs: build: @@ -14,14 +14,18 @@ jobs: uses: actions/checkout@v2 - name: Get current date run: echo "::set-output name=todays_date::$(date +'%Y-%m-%d')" + - name: Get latest tag + run: | + latest_tag_version_value=$(./scripts/find_latest_tag_version.sh) + echo "::set-output name=latest_tag_version::${latest_tag_version_value}" - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: superset-1.0.0-${{ outputs.todays_date.value }} - release_name: superset-1.0.0-${{ outputs.todays_date.value }} + tag_name: superset-${{outputs.latest_tag_version.value}}-weekly-build-${{ outputs.todays_date.value }} + release_name: superset-${{outputs.latest_tag_version.value}}-weekly-build-${{ outputs.todays_date.value }} body: | ##todo: list of commits draft: false diff --git a/scripts/find_latest_tag_version.sh b/scripts/find_latest_tag_version.sh new file mode 100755 index 0000000000000..1115e72cd4a05 --- /dev/null +++ b/scripts/find_latest_tag_version.sh @@ -0,0 +1,49 @@ +#! /bin/bash +# +# 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. +# + + +get_latest_tag_list() { + echo git show-ref latest && git show --pretty=tformat:%d -s latest | grep tag: || echo 'not found' +} + +# look up the 'latest' tag on git +LATEST_TAG_LIST=$(get_latest_tag_list) + +## get all tags that use the same sha as the latest tag. split at comma. +IFS=$',' +LATEST_TAGS=($LATEST_TAG_LIST) + +## loop over those tags and only take action on the one that isn't tagged 'latest' +## that one will have the version number tag +for (( i=0; i<${#LATEST_TAGS[@]}; i++ )) +do + if [[ ${LATEST_TAGS[$i]} != *"latest"* ]] + then + ## extract just the version from this tag + LATEST_RELEASE_TAG=$(echo "${LATEST_TAGS[$i]}" | sed -E -e 's/tag:|\(|\)|[[:space:]]*//g') + + # check that this only contains a proper semantic version + if ! [[ ${LATEST_RELEASE_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] + then + continue + fi + break + fi +done + +echo ${LATEST_RELEASE_TAG} From e13ffb5bc40e7873054a0fc1869950ed536a4987 Mon Sep 17 00:00:00 2001 From: Amit Miran <47772523+amitmiran137@users.noreply.github.com> Date: Sun, 24 Jan 2021 08:35:47 +0200 Subject: [PATCH 5/5] Update scheduled_weekly_build.yml --- .github/workflows/scheduled_weekly_build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/scheduled_weekly_build.yml b/.github/workflows/scheduled_weekly_build.yml index b858a25b317d1..09a7c44ab0688 100644 --- a/.github/workflows/scheduled_weekly_build.yml +++ b/.github/workflows/scheduled_weekly_build.yml @@ -26,7 +26,5 @@ jobs: with: tag_name: superset-${{outputs.latest_tag_version.value}}-weekly-build-${{ outputs.todays_date.value }} release_name: superset-${{outputs.latest_tag_version.value}}-weekly-build-${{ outputs.todays_date.value }} - body: | - ##todo: list of commits draft: false prerelease: false