From 2164b3ca615edf2d7a442139644f1d3210c8bf72 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Wed, 13 Mar 2024 16:45:53 +0900 Subject: [PATCH] ci: refine the scheduled bump run, remove on push --- .github/workflows/version_bump.yml | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/workflows/version_bump.yml b/.github/workflows/version_bump.yml index 37a9420a17..ff3e5a8548 100644 --- a/.github/workflows/version_bump.yml +++ b/.github/workflows/version_bump.yml @@ -4,18 +4,12 @@ name: Version Bump # prevent concurrent version bumps concurrency: - group: "version-bump-${{ github.event_name == 'schedule' && 'alpha' || github.ref_name }}" + group: "version-bump-${{ github.event_name == 'schedule' && 'main' || github.ref_name }}" on: - push: - branches: - # run for everything that gets into main - # - main - # - beta - - # schedule: - # # Schedule for midnight UTC. Adjust according to your timezone - # - cron: "0 0 * * *" # Runs at 00:00 UTC every day + schedule: + # Schedule for midnight UTC. Adjust according to your timezone + - cron: "0 0 * * *" # Runs at 00:00 UTC every day env: RELEASE_PLZ_BIN_URL: https://github.com/MarcoIeni/release-plz/releases/download/release-plz-v0.3.43/release-plz-x86_64-unknown-linux-gnu.tar.gz @@ -23,11 +17,8 @@ env: jobs: bump_version: - # for pushes, we dont run on alpha - # for schedules, we only run on alpha - # and if its maidsafe and not already a release commit. + # only run if its maidsafe repo and not already a release commit. if: > - (github.event_name == 'schedule' && github.ref_name == 'alpha') || github.repository_owner == 'maidsafe' && !startsWith(github.event.head_commit.message, 'chore(release):') runs-on: ubuntu-22.04 @@ -36,8 +27,8 @@ jobs: with: fetch-depth: "0" token: ${{ secrets.VERSION_BUMP_COMMIT_PAT }} - # For scheduled runs, explicitly set ref to 'alpha'. Otherwise, use the triggering ref. - ref: ${{ github.event_name == 'schedule' && 'alpha' || github.ref_name }} + # For scheduled runs, explicitly set ref to 'main'. Otherwise, use the triggering ref. + ref: ${{ github.event_name == 'schedule' && 'main' || github.ref_name }} - name: Get the SHA of the last release commit id: get-sha @@ -54,11 +45,11 @@ jobs: repository-name: ${{ github.repository }} repository-owner: ${{ github.repository_owner }} head-sha: ${{ env.sha }} - base-branch: ${{ github.event_name == 'schedule' && 'alpha' || github.ref_name }} + base-branch: ${{ github.event_name == 'schedule' && 'main' || github.ref_name }} polling-interval: 60 - name: Fetch the latest code from the specified branch - run: git pull origin ${{ github.event_name == 'schedule' && 'alpha' || github.ref_name }} + run: git pull origin ${{ github.event_name == 'schedule' && 'main' || github.ref_name }} - uses: actions-rs/toolchain@v1 with: @@ -84,12 +75,13 @@ jobs: rm release-plz-x86_64-unknown-linux-gnu.tar.gz sudo mv release-plz /usr/local/bin - shell: bash + # run an alpha release bump when scheduled, otherwise run as the branch name run: ./resources/scripts/bump_version.sh ${{ github.event_name == 'schedule' && 'alpha' || github.ref_name }} - name: push version bump commit uses: ad-m/github-push-action@master with: github_token: ${{ secrets.VERSION_BUMP_COMMIT_PAT }} - branch: ${{ github.event_name == 'schedule' && 'alpha' || github.ref_name }} + branch: ${{ github.event_name == 'schedule' && 'main' || github.ref_name }} tags: true - name: post notification to slack on failure if: ${{ failure() }}