From 50370b54aa9419b7a07032070e3b4dc340ca60e2 Mon Sep 17 00:00:00 2001 From: Fred Adeniyi Date: Sun, 13 Jul 2025 12:31:27 +0800 Subject: [PATCH 1/2] ci: Add automatic version bumping and tagging Integrates the `anothrNick/github-tag-action` to automatically bump the version and create a new git tag on every push to the part11-ci-cd-systems branch. This will help in versioning the application and tracking releases. --- .github/workflows/pipeline.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 3e8e516..102237a 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -2,7 +2,7 @@ name: Deployment Pipeline on: pull_request: branches: [part11-ci-cd-systems] - types: [opened, synchronize] + types: [opened, synchronize, closed] push: branches: @@ -59,3 +59,9 @@ jobs: env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} working-directory: part11 + + - name: Bump version and push tag + uses: anothrNick/github-tag-action@1.73.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG_PREFIX: v From d7929a05dcda66c9918506581cb5c167c766b6fe Mon Sep 17 00:00:00 2001 From: Fred Adeniyi Date: Sun, 13 Jul 2025 12:57:05 +0800 Subject: [PATCH 2/2] ci: Refactor workflow to add release tagging job Restructures the CI pipeline into two separate jobs: - `simple_deployment_pipeline`: Handles testing, linting, and deployment. - `tag_release`: Manages version bumping and release tagging. Key changes: - The `tag_release` job runs only after the `simple_deployment_pipeline` job has completed successfully. - Deployment and release tagging are now configured to run only on a push to the `part11-ci-cd-systems` branch, not on pull requests. - The tagging action is configured to perform a `patch` version bump by default. - The `DRY_RUN` option is enabled to simulate version bumping without creating an actual git tag. --- .github/workflows/pipeline.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 102237a..b68a0da 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -1,4 +1,5 @@ -name: Deployment Pipeline +name: Deployment pipeline + on: pull_request: branches: [part11-ci-cd-systems] @@ -50,18 +51,29 @@ jobs: retention-days: 7 - name: Setup flyctl - if: ${{ github.event_name == 'push' }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/part11-ci-cd-systems' }} uses: superfly/flyctl-actions/setup-flyctl@master - name: Deploy to Fly.io - if: ${{ github.event_name == 'push' }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/part11-ci-cd-systems' }} run: flyctl deploy --remote-only -a pokedex-app-6035 env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} working-directory: part11 - + + tag_release: + needs: [simple_deployment_pipeline] + runs-on: ubuntu-24.04 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/part11-ci-cd-systems' }} + steps: + - uses: actions/checkout@v4 + with: + ref: part11-ci-cd-systems + - name: Bump version and push tag uses: anothrNick/github-tag-action@1.73.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TAG_PREFIX: v + DEFAULT_BUMP: patch + DRY_RUN: "true"