From 4354140678cb177b47cd0a98434f65e36824fe4e Mon Sep 17 00:00:00 2001 From: Fred Adeniyi Date: Sun, 13 Jul 2025 10:44:34 +0800 Subject: [PATCH 1/2] Update the trigger of the existing workflow --- .github/workflows/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 11009db..1f01ba8 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -1,6 +1,6 @@ name: Deployment Pipeline on: - push: + pull_request: branches: - part11-ci-cd-systems jobs: From 1ff1d6f615cced6853253462c70b1487bbf8899f Mon Sep 17 00:00:00 2001 From: Fred Adeniyi Date: Sun, 13 Jul 2025 11:51:13 +0800 Subject: [PATCH 2/2] ci: Separate deployment from pull request checks Updates the CI/CD pipeline to: - Trigger on both `pull_request` and `push` to the `part11-ci-cd-systems` branch. - Run all checks (linting, building, testing) on pull requests. - Only run the deployment step to Fly.io on a `push` event (i.e., after a merge). - Use `npm ci` instead of `npm install` for faster and more reliable dependency installation in the CI environment. --- .github/workflows/pipeline.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 8d9c828..3e8e516 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -3,7 +3,10 @@ on: pull_request: branches: [part11-ci-cd-systems] types: [opened, synchronize] - + + push: + branches: + - part11-ci-cd-systems jobs: simple_deployment_pipeline: runs-on: ubuntu-24.04 @@ -17,7 +20,7 @@ jobs: node-version: '20' - name: Install Dependencies - run: npm install + run: npm ci working-directory: part11 - name: Check style @@ -46,8 +49,13 @@ jobs: path: playwright-report/ retention-days: 7 - - uses: superfly/flyctl-actions/setup-flyctl@master - - run: flyctl deploy --remote-only -a pokedex-app-6035 + - name: Setup flyctl + if: ${{ github.event_name == 'push' }} + uses: superfly/flyctl-actions/setup-flyctl@master + + - name: Deploy to Fly.io + if: ${{ github.event_name == 'push' }} + run: flyctl deploy --remote-only -a pokedex-app-6035 env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} working-directory: part11