Skip to content
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
25 changes: 22 additions & 3 deletions common/config/azure-pipelines/npm-post-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,24 @@ extends:
Arguments: 'bump-decoupled-local-dependencies'
DisplayName: 'Bump decoupled local dependencies'

# If Rush itself was updated by bump-decoupled-local-dependencies, we need to bootstrap
# the new version and update the checked-in lockfile before running `rush update`.
# Otherwise install-run-rush.js would fail lockfile validation when trying to install
# the new version of Rush (the checked-in lockfile still references the old version).
- template: /common/config/azure-pipelines/templates/install-run-rush.yaml@self
parameters:
Arguments: '--help'
DisplayName: 'Install new Rush version (skip lockfile validation)'
DisableInstallRunRushLockfile: true
Condition: "eq(variables['RushWasUpdated'], 'true')"

- bash: >
cp
"common/temp/install-run/@microsoft+rush@$(NewRushVersion)/package-lock.json"
common/config/validation/rush-package-lock.json
displayName: 'Update rush-package-lock.json (new Rush version)'
condition: eq(variables['RushWasUpdated'], 'true')

- template: /common/config/azure-pipelines/templates/install-run-rush.yaml@self
parameters:
Arguments: 'update'
Expand All @@ -126,9 +144,6 @@ extends:
Arguments: 'update-autoinstaller --name plugins'
DisplayName: 'Rush Update Autoinstaller (plugins)'

- bash: cp common/temp/install-run/@microsoft+rush@*/package-lock.json common/config/validation/rush-package-lock.json
displayName: 'Update rush-package-lock.json'

- bash: |
set -e

Expand Down Expand Up @@ -188,6 +203,8 @@ extends:
parameters:
Arguments: 'install'
DisplayName: 'Rush Install (rushstack-websites)'
# rushstack-websites doesn't have an `install-run-rush` lockfile checked in
DisableInstallRunRushLockfile: true

- template: /common/config/azure-pipelines/templates/install-run-rush.yaml@self
parameters:
Expand All @@ -196,6 +213,8 @@ extends:
--to-except api.rushstack.io
--verbose
DisplayName: 'Rush Build to-except api.rushstack.io (rushstack-websites)'
# rushstack-websites doesn't have an `install-run-rush` lockfile checked in
DisableInstallRunRushLockfile: true

# Download the api artifact from the triggering publish pipeline.
# AzDO automatically resolves which pipeline resource triggered this run.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ parameters:
- name: RepoPath
type: string
default: '$(Build.SourcesDirectory)'
- name: DisableInstallRunRushLockfile
type: boolean
default: false

steps:
- script: 'node common/scripts/install-run-rush.js ${{ parameters.Arguments }}'
Expand All @@ -22,6 +25,7 @@ steps:
${{ if ne(parameters.Condition, '') }}:
condition: ${{ parameters.Condition }}
env:
INSTALL_RUN_RUSH_LOCKFILE_PATH: ${{ parameters.RepoPath }}/common/config/validation/rush-package-lock.json
${{ if not(parameters.DisableInstallRunRushLockfile) }}:
INSTALL_RUN_RUSH_LOCKFILE_PATH: ${{ parameters.RepoPath }}/common/config/validation/rush-package-lock.json
${{ if ne(parameters.NpmAuthToken, '') }}:
NPM_AUTH_TOKEN: ${{ parameters.NpmAuthToken }}
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,19 @@ export class BumpDecoupledLocalDependencies extends CommandLineAction {
// Update the Rush version in rush.json
const latestRushVersion: string = await _getLatestPublishedVersionAsync(terminal, '@microsoft/rush');
const rushJson: IRushConfigurationJson = await JsonFile.loadAsync(rushJsonFile);
rushJson.rushVersion = latestRushVersion;
await JsonFile.saveAsync(rushJson, rushJsonFile, { updateExistingFile: true });
terminal.writeLine(`Updated ${rushJsonFile}`);
const existingRushVersion: string = rushJson.rushVersion;
const rushWasUpdated: boolean = existingRushVersion !== latestRushVersion;
if (rushWasUpdated) {
rushJson.rushVersion = latestRushVersion;
await JsonFile.saveAsync(rushJson, rushJsonFile, { updateExistingFile: true });
terminal.writeLine(
`Updated ${rushJsonFile}: Rush version ${existingRushVersion} -> ${latestRushVersion}`
);
}

// Emit Azure Pipelines variables so subsequent pipeline steps can handle the Rush version change.
// These are no-ops when run outside of Azure Pipelines.
terminal.writeLine(`##vso[task.setvariable variable=NewRushVersion]${latestRushVersion}`);
terminal.writeLine(`##vso[task.setvariable variable=RushWasUpdated]${rushWasUpdated}`);
}
}