diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 290346223..e742a2b5b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,7 +9,7 @@ on: - master - dev workflow_run: - workflows: + workflows: - Update API client - Update API client (dev) types: @@ -22,8 +22,10 @@ permissions: jobs: publish: if: - (github.event.workflow_run.name == 'Update API client' || github.event.pull_request.base.ref == 'master') && - (github.event.pull_request.merged == true || github.event.workflow_run.conclusion == 'success') + (github.event.workflow_run.name == 'Update API client' || + github.event.pull_request.base.ref == 'master') && + (github.event.pull_request.merged == true || + github.event.workflow_run.conclusion == 'success') runs-on: ubuntu-latest env: @@ -68,12 +70,6 @@ jobs: - name: Build 🔨 run: yarn nx affected -t build --parallel=3 - # TODO: Uses the previous version. Needs a fix! - - name: Create version file 🔢 - run: | - yarn nx run @mittwald/api-client:build:write-version-file - git add . - - name: Version and publish 🚀 if: github.event.workflow_run.head_branch == 'master' || github.ref == @@ -90,10 +86,10 @@ jobs: --tag-version-prefix "" fi - publish-dev: if: - github.event.workflow_run.name == 'Update API client (dev)' && github.event.workflow_run.conclusion == 'success' + github.event.workflow_run.name == 'Update API client (dev)' && + github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest env: @@ -139,12 +135,6 @@ jobs: - name: Build 🔨 run: yarn nx affected -t build --parallel=3 - # TODO: Uses the previous version. Needs a fix! - - name: Create version file 🔢 - run: | - yarn nx run @mittwald/api-client:build:write-version-file - git add . - - name: Version and publish 🚀 run: | git describe --exact-match --tags || code=$? diff --git a/nx.json b/nx.json index b9ff1ec2c..33b88377d 100644 --- a/nx.json +++ b/nx.json @@ -17,7 +17,7 @@ "dependsOn": ["^build"] }, "build:write-version-file": { - "cache": true, + "cache": false, "dependsOn": ["build"] }, "lint": { diff --git a/packages/mittwald/dev/writeVersion.ts b/packages/mittwald/dev/writeVersion.ts index 2c0dea89b..1f5acff3d 100644 --- a/packages/mittwald/dev/writeVersion.ts +++ b/packages/mittwald/dev/writeVersion.ts @@ -2,7 +2,9 @@ import { readPackage } from "read-pkg"; import * as fs from "node:fs"; import * as path from "node:path"; -const { version } = await readPackage(); +const { version } = await readPackage({ + cwd: path.join(import.meta.dirname, ".."), +}); const distFolder = path.join(import.meta.dirname, "../dist"); diff --git a/packages/mittwald/package.json b/packages/mittwald/package.json index e34cd894a..53d97df4a 100644 --- a/packages/mittwald/package.json +++ b/packages/mittwald/package.json @@ -43,7 +43,8 @@ "lint": "run eslint .", "test": "", "test:client-generation-clean": "git diff --exit-code", - "test:compile": "run tsc --noEmit" + "test:compile": "run tsc --noEmit", + "version": "run build:write-version-file" }, "dependencies": { "@mittwald/api-client-commons": "workspace:^",