From c2de6efb615962741849f75790da16b3b02f6952 Mon Sep 17 00:00:00 2001 From: Layton Whiteley Date: Fri, 5 Jan 2024 07:53:50 +0100 Subject: [PATCH] fix: ensure ci process can run on main branch --- .github/workflows/cd.yml | 1 + .github/workflows/ci.yml | 8 ++++++++ package.json | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 1a63452..3e5cdd8 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -28,6 +28,7 @@ jobs: - uses: nrwl/nx-set-shas@v3 # This line is needed for nx affected to work when CI is running on a PR - run: git branch --track main origin/main + if: github.ref == 'refs/heads/main' - run: pnpm nx affected -t test,build --parallel=3 --projects=tag:publish - run: pnpm nx run-many -t publish --projects=tag:publish --tag latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9a211c..d3ccf7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,14 @@ jobs: - uses: nrwl/nx-set-shas@v3 # This line is needed for nx affected to work when CI is running on a PR - run: git branch --track main origin/main + if: github.ref == 'refs/heads/main' - run: pnpm nx format:check - run: pnpm nx affected -t lint,test --parallel=3 + + # Should be run last + - name: Tag main branch if all jobs succeed + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + uses: nrwl/nx-tag-successful-ci-run@v1 + with: + remove-tags-matching-pattern: 'nx_successful_ci_run__' diff --git a/package.json b/package.json index a16732c..643c4a7 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "start": "nx serve", "build": "nx build", "test": "nx test", - "release": "release-it" + "release": "release-it", + "git:clean-tags": "git tag -l | xargs git tag -d && git fetch -t" }, "private": true, "dependencies": {