nx
nx copied to clipboard
Nx Release works locally but not in github actions
Current Behavior
Currently when I run yarn nx release
locally i see the changes since the last tag picked up and a changelog file is written like below.
NX Running release version for project: my-project
my-project ๐ Reading data for package "@my-monorepo/source" from package.json
my-project ๐ Resolved the current version as 0.1.0 from git tag "v0.1.0".
my-project ๐ Resolved the specifier as "minor" using git history and the conventional commits standard.
my-project โ๏ธ New version 0.2.0 written to package.json
UPDATE package.json [dry-run]
"name": "@my-monorepo/source",
- "version": "0.1.0",
+ "version": "0.2.0",
"license": "MIT",
Skipped lock file update because yarn workspaces are not enabled.
NX Staging changed files with git
Would stage files in git with the following command, but --dry-run was set:
git add package.json
NX Previewing an entry in CHANGELOG.md for v0.2.0
UPDATE CHANGELOG.md [dry-run]
+ ## 0.2.0 (2024-06-26)
+
+
+ ### ๐ Features
+
+ - add production environment configuration ([COMMIT HASH](GIT COMMIT HASH URL HERE)
However when I try to run this in a github action i'm getting the following
NX Running release version for project: my-project
my-project ๐ Reading data for package "@my-monorepo/source" from package.json
my-project ๐ Resolved the current version as 0.1.0 from git tag "v0.1.0".
my-project ๐ซ No changes were detected using git history and the conventional commits standard.
my-project ๐ซ Skipping versioning "@my-monorepo/source" as no changes were detected.
And no changelog is generated.
Here is my nx.json config for release and the github action file
"release": {
"projects": ["apps/*", "libs/*", "!*-e2e"],
"version": {
"generatorOptions": {
"currentVersionResolver": "git-tag",
"specifierSource": "conventional-commits"
}
},
"changelog": {
"workspaceChangelog": {
"createRelease": "github"
}
}
},
name: Release
on:
workflow_dispatch:
push:
branches:
- main
paths:
# ignore push events that only include package.json or CHANGELOG.md files
- '!package.json'
- '!CHANGELOG.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch Tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git fetch origin --tags
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20.15.0
cache: 'yarn'
- name: Restore cached npm Dependencies
id: cache-dependencies-restore
uses: actions/cache/restore@v4
with:
path: |
node_modules
~/.cache/Cypress # needed for the Cypress binary
key: npm-dependencies-${{ hashFiles('yarn.lock') }}
- name: Install Dependencies
run: SKIP_POSTINSTALL=1 yarn install # will run `yarn install` command
- name: Run Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn nx release
I have tried both Yarn and Npm and neither work in github actions for me. But both work locally
Expected Behavior
I should see the changelog generated through github workflow.
GitHub Repo
No response
Steps to Reproduce
- add the release yaml to the .github/workflows and run it yoru project after having already don't the first run of release.
Nx Report
Github NX Report
NX Report complete - copy this into the issue template
Node : 20.15.0
OS : linux-x64
yarn : 4.2.2
nx : 19.3.1
@nx/js : 19.3.1
@nx/jest : 19.3.1
@nx/linter : 19.3.1
@nx/eslint : 19.3.1
@nx/workspace : 19.3.1
@nx/cypress : 19.3.1
@nx/devkit : 19.3.1
@nx/esbuild : 19.3.1
@nx/eslint-plugin : 19.3.1
@nx/nest : 19.3.1
@nx/next : 19.3.1
@nx/node : 19.3.1
@nx/plugin : 19.3.1
@nx/react : 19.3.1
@nrwl/tao : 19.3.1
@nx/vite : 19.3.1
@nx/web : 19.3.1
@nx/webpack : 19.3.1
typescript : 5.4.5
---------------------------------------
Registered Plugins:
@nx/next/plugin
@nx/cypress/plugin
@nx/eslint/plugin
@nx/jest/plugin
@nx/webpack/plugin
@nx/vite/plugin
Local NX Report
Node : 20.15.0
OS : darwin-arm64
yarn : 4.2.2
nx : 19.3.1
@nx/js : 19.3.1
@nx/jest : 19.3.1
@nx/linter : 19.3.1
@nx/eslint : 19.3.1
@nx/workspace : 19.3.1
@nx/cypress : 19.3.1
@nx/devkit : 19.3.1
@nx/esbuild : 19.3.1
@nx/eslint-plugin : 19.3.1
@nx/nest : 19.3.1
@nx/next : 19.3.1
@nx/node : 19.3.1
@nx/plugin : 19.3.1
@nx/react : 19.3.1
@nrwl/tao : 19.3.1
@nx/vite : 19.3.1
@nx/web : 19.3.1
@nx/webpack : 19.3.1
typescript : 5.4.5
---------------------------------------
Registered Plugins:
@nx/next/plugin
@nx/cypress/plugin
@nx/eslint/plugin
@nx/jest/plugin
@nx/webpack/plugin
@nx/vite/plugin
Failure Logs
No failure logs just no changelog generated or changes since tag detected
Package Manager Version
No response
Operating System
- [X] macOS
- [X] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
No response