From 42b5a5d621a4686446552721c523b475dd9631e2 Mon Sep 17 00:00:00 2001 From: devsjc <47188100+devsjc@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:25:22 +0000 Subject: [PATCH] fix(ci): Remove chaining dependancy --- .github/workflows/main_ci.yml | 45 ------------------- .../{tagged_ci.yml => merged_ci.yml} | 45 +++++++++++++++---- 2 files changed, 37 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/main_ci.yml rename .github/workflows/{tagged_ci.yml => merged_ci.yml} (81%) diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml deleted file mode 100644 index a0bc5e3..0000000 --- a/.github/workflows/main_ci.yml +++ /dev/null @@ -1,45 +0,0 @@ -# Workflow that runs on closed PRs to the default branch - -name: Default Branch PR Merged CI (Python) - -on: - pull_request: - types: ["closed"] - branches: ["main"] - -# Specify concurrency such that only one workflow can run at a time -# * Different workflow files are not affected -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: false - - -jobs: - - # Define an autotagger job that creates tags on changes to master - # Use #major #minor in merge commit messages to bump version beyond patch - bump-tag: - runs-on: ubuntu-latest - if: | - github.event_name == 'pull_request' && - github.event.action == 'closed' && - github.event.pull_request.merged == true - permissions: - contents: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Bump version and push tag - uses: anothrNick/github-tag-action@1.67.0 - id: tag - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_BRANCHES: main - WITH_V: true - DEFAULT_BUMP: patch - GIT_API_TAGGING: false - diff --git a/.github/workflows/tagged_ci.yml b/.github/workflows/merged_ci.yml similarity index 81% rename from .github/workflows/tagged_ci.yml rename to .github/workflows/merged_ci.yml index 1389a31..7a5be5f 100644 --- a/.github/workflows/tagged_ci.yml +++ b/.github/workflows/merged_ci.yml @@ -1,11 +1,11 @@ -# Workflow that runs on new SemVer tags on the default branch +# Workflow that runs on closed PRs to the default branch -name: Default Branch SemVer Tagged CI (Python) +name: Default Branch PR Merged CI (Python) on: - push: - tags: ['v[0-9]+.[0-9]+.[0-9]+'] - paths-ignore: ['README.md'] + pull_request: + types: ["closed"] + branches: ["main"] # Specify concurrency such that only one workflow can run at a time # * Different workflow files are not affected @@ -13,7 +13,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false -# Registry for storing Container images env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} @@ -21,10 +20,40 @@ env: jobs: + # Define an autotagger job that creates tags on changes to master + # Use #major #minor in merge commit messages to bump version beyond patch + bump-tag: + runs-on: ubuntu-latest + if: | + github.event_name == 'pull_request' && + github.event.action == 'closed' && + github.event.pull_request.merged == true + permissions: + contents: write + outputs: + tag: ${{ steps.tag.outputs.tag }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Bump version and push tag + uses: anothrNick/github-tag-action@1.67.0 + id: tag + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_BRANCHES: main + WITH_V: true + DEFAULT_BUMP: patch + GIT_API_TAGGING: false + # Job for building container image # * Builds and pushes an OCI Container image to the registry defined in the environment variables build-container: runs-on: ubuntu-latest + needs: bump-tag permissions: contents: read packages: write @@ -54,7 +83,7 @@ jobs: uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: type=semver,pattern={{version}} + tags: type=semver,pattern={{version}},value=${{ needs.bump-tag.outputs.tag }} # Build and push the Container image to the registry # * Creates a multiplatform-aware image @@ -71,10 +100,10 @@ jobs: cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max - # Job to build and publish the package on PyPi as a wheel build-wheel: runs-on: ubuntu-latest + needs: bump-tag steps: # Do a non-shallow clone of the repo to ensure tags are present