diff --git a/.github/workflows/bump-stage-and-upload-to-jfrog.yml b/.github/workflows/bump-stage-and-upload-to-jfrog.yml index 33981e782..25612cce8 100644 --- a/.github/workflows/bump-stage-and-upload-to-jfrog.yml +++ b/.github/workflows/bump-stage-and-upload-to-jfrog.yml @@ -1,12 +1,14 @@ on: workflow_call: inputs: - tested-dev-tag: + passed-dev-tag: type: string required: true secrets: + # Used to bump version in Github CLIENT_BOT_PAT: required: true + # Used to upload to JFrog JFROG_PLATFORM_URL: required: true JFROG_ACCESS_TOKEN: @@ -14,13 +16,15 @@ on: jobs: ff-stage-to-dev-tag: + name: Fast forward stage branch to the dev tag that passed stage testing uses: ./.github/workflows/fast-forward-merge.yml with: - ref_to_merge: ${{ inputs.tested-dev-tag }} + ref_to_merge: ${{ inputs.passed-dev-tag }} base_branch: ${{ vars.STAGE_BRANCH_NAME }} secrets: inherit promote-dev-build-to-rc: + name: Bump (promote) the dev version to an RC version in the stage branch needs: ff-stage-to-dev-tag uses: ./.github/workflows/bump-version.yml with: @@ -29,17 +33,16 @@ jobs: secrets: inherit rebuild-artifacts-with-rc-version: - # We want to make sure the "bump to RC" commit is ready to use for rebuilding on needs: promote-dev-build-to-rc uses: ./.github/workflows/build-wheels.yml with: ref: ${{ needs.promote-dev-build-to-rc.outputs.bump_sha }} - upload-to-jfrog: + upload-rc-artifacts-to-jfrog: needs: [ rebuild-artifacts-with-rc-version, # We need the new RC version to label the build in JFrog - promote-dev-build-to-rc, + promote-dev-build-to-rc ] name: Upload artifacts to JFrog uses: ./.github/workflows/upload-to-jfrog.yml @@ -47,7 +50,8 @@ jobs: version: ${{ needs.promote-dev-build-to-rc.outputs.new_version }} secrets: inherit - ff-dev-to-stage: + ff-dev-to-stage: + name: Fast forward dev branch to stage branch to include the bump to RC commit needs: promote-dev-build-to-rc uses: ./.github/workflows/fast-forward-merge.yml with: diff --git a/.github/workflows/dev-to-stage.yml b/.github/workflows/dev-to-stage.yml index 5ead76260..c5b2b64ed 100644 --- a/.github/workflows/dev-to-stage.yml +++ b/.github/workflows/dev-to-stage.yml @@ -5,25 +5,10 @@ on: workflow_dispatch: jobs: - get-latest-dev-tag: - outputs: - latest-dev-version: ${{ steps.get-dev-version.outputs.latest-dev-version }} - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - # Get all tags - fetch-depth: 0 - ref: ${{ vars.DEV_BRANCH_NAME }} - - - name: Get latest dev version - run: echo latest-dev-version=$(git describe --tags --abbrev=0) >> $GITHUB_OUTPUT - id: get-dev-version - - compare-dev-tag-and-stage: + compare-latest-dev-tag-and-stage: outputs: + latest-dev-tag: ${{ steps.get-dev-tag.outputs.latest-dev-tag }} run_stage_tests: ${{ steps.run_stage_tests.outputs.run_stage_tests }} - needs: get-latest-dev-tag runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -31,6 +16,10 @@ jobs: # Get all tags fetch-depth: 0 + - name: Get latest dev tag + run: echo latest-dev-tag=$(git describe --tags --abbrev=0 origin/${{ vars.DEV_BRANCH_NAME }}) >> $GITHUB_OUTPUT + id: get-dev-tag + - name: Get number of files that were changed between dev and stage (with some exceptions) run: echo NUM_FILES_CHANGED=$(git diff origin/${{ vars.STAGE_BRANCH_NAME }}..origin/${{ vars.DEV_BRANCH_NAME }} --name-only | grep --invert-match --count -e "^doc/" -e "^aerospike-stubs/" -e VERSION) >> $GITHUB_ENV # We want this step to fail if a command failed while using pipes @@ -41,30 +30,26 @@ jobs: id: run_stage_tests run-stage-tests: - needs: [ - get-latest-dev-tag, - compare-dev-tag-and-stage - ] - if: ${{ needs.compare-dev-tag-and-stage.outputs.run_stage_tests == 'true' }} + needs: compare-latest-dev-tag-and-stage + if: ${{ needs.compare-latest-dev-tag-and-stage.outputs.run_stage_tests == 'true' }} uses: ./.github/workflows/stage-tests.yml with: - ref: ${{ needs.get-latest-dev-tag.outputs.latest-dev-version }} + ref: ${{ needs.compare-latest-dev-tag-and-stage.outputs.latest-dev-tag }} secrets: inherit # Stage tests have passed or skipped - # so it is safe to update the stage branch with the changes in dev - # and upload RC builds with the tested changes to JFrog - # We store the subsequent jobs after the stage tests in a separate reusable workflow + # so it is safe to update the stage branch with the changes in dev, promote the version to an RC, and rebuild and upload the RC to JFrog + # We store the subsequent jobs after the stage tests in a separate reusable workflow... # because if stage tests were skipped, all subsequent jobs will be skipped by default too (both direct and indirect descendents) # This means we have to add a manual check for each subsequent job that checks if the stage tests were skipped in order to run them - # It's easier to just add this manual check once to a reusable workflow that wraps around all those jobs + # It's easier to just add this manual check once to a reusable workflow that wraps around all the subsequent jobs bump-stage-and-upload-to-jfrog: needs: [ run-stage-tests, - get-latest-dev-tag + compare-latest-dev-tag-and-stage ] - if: ${{ !cancelled() && needs.get-latest-dev-tag.result == 'success' && (needs.run-stage-tests.result == 'success' || needs.run-stage-tests.result == 'skipped') }} + if: ${{ !cancelled() && needs.compare-latest-dev-tag-and-stage.result == 'success' && (needs.run-stage-tests.result == 'success' || needs.run-stage-tests.result == 'skipped') }} uses: ./.github/workflows/bump-stage-and-upload-to-jfrog.yml with: - tested-dev-tag: ${{ needs.get-latest-dev-tag.outputs.latest-dev-version }} + passed-dev-tag: ${{ needs.compare-latest-dev-tag-and-stage.outputs.latest-dev-tag }} secrets: inherit