Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N8N-15 Add workflow to automate nx updates #167

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/nx-dependency-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: nx Dependency Update

on:
workflow_call:
inputs:
pull_request_ref:
required: true
type: string

jobs:
update-nx-dependencies:
name: Update nx dependencies and apply migrations
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.pull_request_ref }}

- name: Setup git user
uses: fregante/setup-git-user@v2

- name: Fetch dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v2

- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: npm

- name: Install Dependencies
run: npm ci

- name: Migrate nx
run: |
npx nx migrate ${{ steps.dependabot-metadata.outputs.new-version }} \
--from nx@${{ steps.dependabot-metadata.outputs.previous-version }}

- name: Install updated depenencies
run: npm install

- name: Commit changes to package(-lock).json
uses: stefanzweifel/git-auto-commit-action@v5
with:
# yamllint disable-line rule:line-length
commit_message: 'chore: bump nx dependencies to ${{ steps.dependabot-metadata.outputs.new-version }}'
file_pattern: 'package.json package-lock.json'
push_options: --dry-run
skip_fetch: true
skip_checkout: true

- name: Execute migrations
run: npx nx migrate --run-migrations --if-exists --create-commits
env:
npm_config_legacy_peer_deps: false

- name: Push changes
run: git push origin HEAD:${{ inputs.pull_request_ref }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/.cache
/.nx/cache
/.nx/workspace-data
/migrations.json

# Coverage
/coverage
Expand Down