From e4f2ef677eea08196cc20d2b0b3b19aecb833fc3 Mon Sep 17 00:00:00 2001 From: Cameron Koegel Date: Wed, 30 Nov 2022 10:05:16 -0500 Subject: [PATCH 1/3] DX-3002 Add Auto Release Workflow --- .github/workflows/auto-release.yml | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/auto-release.yml diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml new file mode 100644 index 000000000..f8d86dd4b --- /dev/null +++ b/.github/workflows/auto-release.yml @@ -0,0 +1,34 @@ +name: Create Release + +on: + schedule: + - cron: '0 9 * * *' + +jobs: + release_needed: + name: Check for Diff Between Main and the Latest Release + runs-on: ubuntu-latest + outputs: + release_needed: ${{ steps.release_needed.outputs.release_needed }} + steps: + - name: Determine if New Release is Needed + id: release_needed + run: | + REL_TIME=$(curl -Ls -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/latest | jq -r '.published_at') # Get latest release time + COMMITS=$(curl -Ls -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/commits?since=$REL_TIME | jq '. | length') # Get all commits since last release + if [ $COMMITS '>' 0 ]; then echo "release_needed=true" >> $GITHUB_OUTPUT; else :; fi # If there have been commits to main since the last release, make a new release + env: + TOKEN: ${{ secrets.DX_GITHUB_TOKEN }} + + create_release: + name: Create A New Release + runs-on: ubuntu-latest + needs: release_needed + if: ${{needs.release_needed.outputs.release_needed}} + steps: + - name: Make Release + run: | + TAG=$(date +"v%Y.%m.%d") # Format release name/tag using current date + curl -Lfs -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases -d '{"tag_name":"'"$TAG"'","name":"'"$TAG"'","generate_release_notes":true}' # Create release + env: + TOKEN: ${{ secrets.DX_GITHUB_TOKEN }} From 2a2b64595c8d61d3426293a1ad59b381837d9aef Mon Sep 17 00:00:00 2001 From: Cameron Koegel Date: Wed, 30 Nov 2022 10:27:48 -0500 Subject: [PATCH 2/3] update cron for weekdays --- .github/workflows/auto-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index f8d86dd4b..30e382cf9 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -2,7 +2,7 @@ name: Create Release on: schedule: - - cron: '0 9 * * *' + - cron: '0 9 * * 1-5' jobs: release_needed: From 569a16e4ff1109437ea1f717ce99ed5a602fe716 Mon Sep 17 00:00:00 2001 From: Cameron Koegel Date: Thu, 1 Dec 2022 15:12:48 -0500 Subject: [PATCH 3/3] fix cron time to adjust to UTC --- .github/workflows/auto-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 30e382cf9..1a269db01 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -2,7 +2,7 @@ name: Create Release on: schedule: - - cron: '0 9 * * 1-5' + - cron: '0 14 * * 1-5' jobs: release_needed: