-
Notifications
You must be signed in to change notification settings - Fork 5
91 lines (89 loc) · 3.96 KB
/
ci_nx_migrate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# name: 'Nx migrate'
# on:
# schedule:
# - cron: '30 13 1 * *' # Runs Monthly on the 1st.
# workflow_dispatch: # adding the workflow_dispatch so it can be triggered manually
# env:
# BASE: ${{ github.ref == 'refs/heads/develop' && 'origin/develop~1' || 'origin/develop' }}
# jobs:
# nx-migrate:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"
# - uses: actions/cache@v2
# id: yarn-cache
# with:
# path: |
# **/node_modules
# ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-yarn-
# - uses: actions/setup-node@v2
# with:
# node-version: 16.x
# # This doesn't just set the registry url, but also sets
# # the right configuration in .npmrc that reads NPM token
# # from NPM_AUTH_TOKEN environment variable.
# # It actually creates a .npmrc in a temporary folder
# # and sets the NPM_CONFIG_USERCONFIG environment variable.
# registry-url: https://registry.npmjs.org
# - run: npm install -g nx
# - name: Install dependencies
# run: yarn install --frozen-lockfile
# - name: Check if @nrwl/workspace is outdated
# id: nrwl-workspace-outdated
# run: |
# IS_OUTDATED=$(test ! -z "$(npm outdated @nrwl/workspace)" && echo true || echo false)
# echo $IS_OUTDATED
# echo "::set-output name=outdated::$IS_OUTDATED"
# - name: Test mono pre migrations
# if: steps.nrwl-workspace-outdated.outputs.outdated == 'true'
# run: NODE_OPTIONS=--experimental-vm-modules nx affected:test --base $BASE
# - name: Update @nrwl/workspace
# if: steps.nrwl-workspace-outdated.outputs.outdated == 'true'
# run: echo 1 | nx migrate latest
# - name: Exit if outdated === false
# if: steps.nrwl-workspace-outdated.outputs.outdated == 'false'
# run: |
# exit 1
# - name: Check if has migrations
# id: nrwl-workspace-has-migrations
# run: |
# HAS_MIGRATIONS=$(test -f migrations.json && echo true || echo false)
# echo $HAS_MIGRATIONS
# echo "::set-output name=has_migrations::$HAS_MIGRATIONS"
# - name: Run @nrwl/workspace migrations
# if: steps.nrwl-workspace-has-migrations.outputs.has_migrations == 'true'
# run: npx nx migrate --run-migrations
# - name: Setup git user to "🤖 Moloch Bot"
# shell: bash
# run: git config user.email "-" && git config user.name "🤖 Moloch Bot"
# - name: Commit changes
# if: steps.nrwl-workspace-outdated.outputs.outdated == 'true'
# run: |
# git add .
# [[ $(git status --porcelain) ]] && git commit -m "build: 📦 update nrwl workspace" || echo "nothing to commit"
# - name: Remove migrations.json & commit
# if: steps.nrwl-workspace-has-migrations.outputs.has_migrations == 'true'
# run: |
# git rm -f migrations.json
# git commit -m "build: 📦 remove migrations.json"
# - name: Get current nx version
# id: nx-version
# run: echo "::set-output name=version::$(npm view @nrwl/workspace version)"
# - name: Create NX Migration Branch
# if: steps.nrwl-workspace-outdated.outputs.outdated == 'true'
# run: |
# BRANCH="update-nrwl-workspace-${{ steps.nx-version.outputs.version }}"
# git checkout -b "${BRANCH}"
# git push -f --set-upstream origin "${BRANCH}"
# - name: Test mono post migrations
# run: NODE_OPTIONS=--experimental-vm-modules nx affected:test --base $BASE
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}