Skip to content

Commit 0a2c5ce

Browse files
committed
ci: separate release pipeline into 2 jobs
1 parent 765217c commit 0a2c5ce

File tree

1 file changed

+34
-15
lines changed

1 file changed

+34
-15
lines changed

azure-pipelines.yml

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ parameters:
88
displayName: Dry run mode
99
type: boolean
1010
default: true
11-
# This is handy in scenario where actual `npm publish` failed on previous run. This can be used repeatedly until all assets are released to npm to mitigate out of sync publish state
12-
- name: publish_only
13-
displayName: Re-trigger npm publish only
14-
type: boolean
15-
default: false
1611
# Projects to include within release. (comma/space delimited project names and/or patterns). See `--project` flag for more details https://nx.dev/nx-api/nx/documents/release#publish
1712
- name: projects
1813
displayName: Projects to release (defaults to all)
@@ -49,6 +44,7 @@ extends:
4944
- stage: main
5045
jobs:
5146
- job: Release
47+
displayName: 'Release New Version'
5248
pool:
5349
name: '1ES-Host-Ubuntu'
5450
image: '1ES-PT-Ubuntu-20.04'
@@ -70,10 +66,10 @@ extends:
7066
echo "##vso[task.setvariable variable=shellopts]braceexpand:hashall:interactive-comments:errexit:errtrace"
7167
displayName: Force exit on error (bash)
7268
73-
- task: NodeTool@0
69+
- task: UseNode@1
7470
inputs:
7571
versionSpec: '20.x'
76-
checkLatest: true
72+
checkLatest: false
7773
displayName: 'Install Node.js'
7874

7975
- script: yarn install --frozen-lockfile
@@ -88,27 +84,50 @@ extends:
8884
git config user.name "Fluent UI Build"
8985
git config user.email "fluentui-internal@service.microsoft.com"
9086
git remote set-url origin https://$(githubUser):$(githubPAT)@github.com/microsoft/fluentui-contrib.git
91-
condition: or(eq(parameters.dry_run, false), eq(parameters.publish_only, false))
87+
condition: eq(parameters.dry_run, false)
9288
displayName: Authenticate git for pushes
9389
9490
- script: |
95-
yarn nx release --skip-publish -p ${{ parameters.projects }} --dry-run ${{ parameters.dry_run }}
96-
condition: eq(parameters.publish_only, false)
91+
yarn nx release --skip-publish -p ${{ parameters.projects }} --dry-run ${{ parameters.dry_run }} --verbose
9792
displayName: Bump versions and generate Changelogs
9893
99-
# NOTE: this step needs PAT - will be mitigate with new architecture
94+
# NOTE: this step needs PAT - needs different release flow to avoid PATs completely
10095
- script:
101-
| # TODO: check if NX release uses annotated or lightweight tags - if annotated can be simplified to `git push origin --follow-tags`
96+
| # TODO: remove this step once https://github.com/nrwl/nx/issues/30551 is resolved
10297
git push origin && git push origin --tags
103-
condition: or(eq(parameters.dry_run, false), eq(parameters.publish_only, false))
98+
condition: eq(parameters.dry_run, false)
10499
displayName: Propagate Release to GitHub
105100
env:
106101
GITHUB_PAT: $(githubPAT)
107102

108-
# TODO: move this to separate job so in case of npm failure we can re-trigger until everything is successfully published
103+
- job: PublishToNPM
104+
displayName: 'Publish to NPM'
105+
dependsOn: Release
106+
condition: succeeded('Release')
107+
pool:
108+
name: '1ES-Host-Ubuntu'
109+
image: '1ES-PT-Ubuntu-20.04'
110+
os: linux
111+
workspace:
112+
clean: all
113+
templateContext:
114+
outputs:
115+
- output: pipelineArtifact
116+
targetPath: $(System.DefaultWorkingDirectory)/packages
117+
artifactName: output
118+
steps:
119+
- task: UseNode@1
120+
inputs:
121+
versionSpec: '20.x'
122+
checkLatest: false
123+
displayName: 'Install Node.js'
124+
125+
- script: yarn install --frozen-lockfile
126+
displayName: Install dependencies
127+
128+
# NOTE: `nx release publish` executes `nx-release-publish` target and all its dependents
109129
- script: |
110130
yarn nx release publish -p ${{ parameters.projects }} --dry-run ${{ parameters.dry_run }}
111-
condition: succeeded()
112131
displayName: Publish to NPM
113132
env:
114133
NODE_AUTH_TOKEN: $(npmToken)

0 commit comments

Comments
 (0)