microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
.ci/test-preview-release.yml
150lines · modecode
| 1 | trigger: none |
| 2 | |
| 3 | # TODO |
| 4 | # schedules: |
| 5 | |
| 6 | name: $(date:yyyyMMdd)$(rev:.r) |
| 7 | appendCommitMessageToRunName: false |
| 8 | |
| 9 | parameters: |
| 10 | - name: dryRun |
| 11 | displayName: Dry run |
| 12 | type: boolean |
| 13 | default: false |
| 14 | |
| 15 | resources: |
| 16 | repositories: |
| 17 | - repository: 1ESPipelineTemplates |
| 18 | type: git |
| 19 | name: 1ESPipelineTemplates/1ESPipelineTemplates |
| 20 | ref: refs/tags/release |
| 21 | pipelines: |
| 22 | - pipeline: 'TypeScript_Native_Preview' |
| 23 | project: 'DevDiv' |
| 24 | source: 'TypeScript Native Preview' |
| 25 | trigger: |
| 26 | tags: |
| 27 | - Build.Reason.Schedule |
| 28 | branches: |
| 29 | include: |
| 30 | - main |
| 31 | |
| 32 | extends: |
| 33 | template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates |
| 34 | |
| 35 | parameters: |
| 36 | sdl: |
| 37 | sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES |
| 38 | pool: |
| 39 | name: AzurePipelines-EO |
| 40 | image: 1ESPT-Ubuntu22.04 |
| 41 | os: linux |
| 42 | |
| 43 | stages: |
| 44 | - stage: Publish |
| 45 | displayName: Publish |
| 46 | |
| 47 | jobs: |
| 48 | - job: Publish_npm |
| 49 | displayName: Publish npm |
| 50 | |
| 51 | templateContext: |
| 52 | templateContext: |
| 53 | type: releaseJob |
| 54 | isProduction: true |
| 55 | inputs: |
| 56 | - input: pipelineArtifact |
| 57 | pipeline: 'TypeScript_Native_Preview' |
| 58 | artifactName: 'npm' |
| 59 | targetPath: '$(Pipeline.Workspace)/npm' |
| 60 | |
| 61 | steps: |
| 62 | - checkout: none |
| 63 | |
| 64 | - task: AzureKeyVault@2 |
| 65 | inputs: |
| 66 | azureSubscription: TypeScript-DevDiv-KeyVault |
| 67 | KeyVaultName: jststeam-passwords |
| 68 | SecretsFilter: typescript-deploys-npm-typescript-native-preview |
| 69 | displayName: Get secrets |
| 70 | retryCountOnTaskFailure: 3 |
| 71 | |
| 72 | - task: NodeTool@0 |
| 73 | inputs: |
| 74 | versionSpec: 20.x |
| 75 | displayName: 'Install Node' |
| 76 | |
| 77 | - bash: | |
| 78 | ls -R $(Pipeline.Workspace)/npm |
| 79 | displayName: 'List contents of artifacts' |
| 80 | |
| 81 | - bash: | |
| 82 | set -euo pipefail |
| 83 | npm set "//registry.npmjs.org/:_authToken=$NPM_TOKEN" |
| 84 | npm whoami |
| 85 | displayName: 'Set auth token' |
| 86 | env: |
| 87 | NPM_TOKEN: $(typescript-deploys-npm-typescript-native-preview) |
| 88 | |
| 89 | - ${{ if eq(parameters.dryRun, false) }}: |
| 90 | - bash: | |
| 91 | set -euo pipefail |
| 92 | cd $(Pipeline.Workspace)/npm |
| 93 | cat publish-order.txt | while read pkg; do |
| 94 | echo "Publishing $pkg" |
| 95 | npm publish $pkg --tag latest |
| 96 | done |
| 97 | displayName: 'Publish npm packages' |
| 98 | |
| 99 | - job: Publish_vsix |
| 100 | displayName: Publish VSIX |
| 101 | |
| 102 | templateContext: |
| 103 | templateContext: |
| 104 | type: releaseJob |
| 105 | isProduction: true |
| 106 | inputs: |
| 107 | - input: pipelineArtifact |
| 108 | pipeline: 'TypeScript_Native_Preview' |
| 109 | artifactName: 'vsix' |
| 110 | targetPath: '$(Pipeline.Workspace)/vsix' |
| 111 | |
| 112 | steps: |
| 113 | - checkout: none |
| 114 | |
| 115 | - task: NodeTool@0 |
| 116 | inputs: |
| 117 | versionSpec: 20.x |
| 118 | displayName: 'Install Node' |
| 119 | |
| 120 | - bash: | |
| 121 | ls -R $(Pipeline.Workspace)/vsix |
| 122 | displayName: 'List contents of artifacts' |
| 123 | |
| 124 | - task: AzureCLI@2 |
| 125 | displayName: 'Check Marketplace Auth' |
| 126 | inputs: |
| 127 | azureSubscription: TypeScript-VSMarketplacePublishAuth |
| 128 | scriptType: 'bash' |
| 129 | scriptLocation: 'inlineScript' |
| 130 | inlineScript: | |
| 131 | set -euo pipefail |
| 132 | az rest -u https://app.vssps.visualstudio.com/_apis/profile/profiles/me --resource 499b84ac-1321-427f-aa17-267ca6975798 |
| 133 | npx @vscode/vsce@latest verify-pat TypeScriptTeam --azure-credential |
| 134 | |
| 135 | - ${{ if eq(parameters.dryRun, false) }}: |
| 136 | - task: AzureCLI@2 |
| 137 | displayName: 'Publish VSIXs to Marketplace' |
| 138 | inputs: |
| 139 | azureSubscription: TypeScript-VSMarketplacePublishAuth |
| 140 | scriptType: 'bash' |
| 141 | scriptLocation: 'inlineScript' |
| 142 | inlineScript: | |
| 143 | set -euo pipefail |
| 144 | cd $(Pipeline.Workspace)/vsix |
| 145 | for vsixFilePath in *.vsix; do |
| 146 | manifestFilePath=${vsixFilePath%.vsix}.manifest |
| 147 | signatureFilePath=${vsixFilePath%.vsix}.signature.p7s |
| 148 | echo "Verifying $manifestFilePath with $manifestFilePath and $signatureFilePath" |
| 149 | npx @vscode/vsce@latest publish --packagePath $vsixFilePath --manifestPath $manifestFilePath --signaturePath $signatureFilePath --azure-credential |
| 150 | done |
| 151 | |