-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor package release into one pipeline (#1403)
- Loading branch information
1 parent
26074ce
commit 107162a
Showing
7 changed files
with
110 additions
and
173 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
trigger: none | ||
pr: none | ||
|
||
parameters: | ||
- name: publish_dev | ||
displayName: 'Publish Dev Release only' | ||
type: boolean | ||
default: true | ||
- name: release_autorestgo | ||
displayName: '@autorest/go' | ||
type: boolean | ||
default: false | ||
- name: release_autorestgotest | ||
displayName: '@autorest/gotest' | ||
type: boolean | ||
default: false | ||
- name: release_typespecgo | ||
displayName: '@azure-tools/typespec-go' | ||
type: boolean | ||
default: false | ||
|
||
extends: | ||
template: /eng/pipelines/templates/stages/1es-redirect.yml | ||
parameters: | ||
stages: | ||
- stage: Release | ||
|
||
variables: | ||
- template: /eng/pipelines/templates/variables/image.yml | ||
|
||
jobs: | ||
- job: Release | ||
pool: | ||
name: $(LINUXPOOL) | ||
image: $(LINUXVMIMAGE) | ||
os: linux | ||
|
||
steps: | ||
- template: /eng/pipelines/templates/steps/set-env.yaml | ||
|
||
- ${{ if eq(parameters.release_autorestgo, true) }}: | ||
- template: /eng/pipelines/templates/steps/build-test-go.yaml | ||
- template: /eng/pipelines/templates/steps/publish-release.yaml | ||
parameters: | ||
PackagePath: "autorest.go" | ||
PackageFileName: "autorest-go" | ||
ReleaseName: "Autorest for Go v$currentVersion" | ||
ReleaseNotes: "Autorest for Go track 2" | ||
PublishDevVersion: ${{ parameters.publish_dev }} | ||
|
||
- ${{ if eq(parameters.release_autorestgotest, true) }}: | ||
- template: /eng/pipelines/templates/steps/build-test-gotest.yaml | ||
- template: /eng/pipelines/templates/steps/publish-release.yaml | ||
parameters: | ||
PackagePath: "autorest.gotest" | ||
PackageFileName: "autorest-gotest" | ||
ReleaseName: "@autorest/gotest_v$currentVersion" | ||
ReleaseNotes: "Go test generation" | ||
PublishDevVersion: ${{ parameters.publish_dev }} | ||
|
||
- ${{ if eq(parameters.release_typespecgo, true) }}: | ||
- template: /eng/pipelines/templates/steps/build-test-typespec.yaml | ||
- template: /eng/pipelines/templates/steps/publish-release.yaml | ||
parameters: | ||
PackagePath: "typespec-go" | ||
PackageFileName: "azure-tools-typespec-go" | ||
ReleaseName: "TypeSpec emitter for Go SDKs v$currentVersion" | ||
ReleaseNotes: "TypeSpec emitter for Go SDKs" | ||
PublishDevVersion: ${{ parameters.publish_dev }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
parameters: | ||
PackagePath: "not-specified" | ||
PackageFileName: "not-specfied" | ||
ReleaseName: "not-specified" | ||
ReleaseNotes: "not-specfied" | ||
PublishDevVersion: true | ||
|
||
steps: | ||
- pwsh: | | ||
$currentVersion = node -p -e "require('./packages/${{ parameters.PackagePath }}/package.json').version" | ||
$releaseNotes = "${{ parameters.ReleaseNotes }}" | ||
if ('${{ parameters.PublishDevVersion }}' -eq 'true') { | ||
$currentVersion="$currentVersion-$(Build.BuildNumber)" | ||
$releaseNotes = "Preview version of ${{ parameters.ReleaseNotes }}" | ||
} | ||
cd packages/${{ parameters.PackagePath }} | ||
npm version --no-git-tag-version $currentVersion | ||
npm pack | ||
npm install -g ${{ parameters.PackageFileName }}-$currentVersion.tgz | ||
if ($LASTEXITCODE) { | ||
exit $LASTEXITCODE | ||
} | ||
npx publish-release ` | ||
--token $(azuresdk-github-pat) ` | ||
--repo autorest.go ` | ||
--owner azure ` | ||
--name "${{ parameters.ReleaseName }}" ` | ||
--tag v$currentVersion ` | ||
--notes="$releaseNotes" ` | ||
--prerelease ` | ||
--editRelease false ` | ||
--assets ${{ parameters.PackageFileName }}-$currentVersion.tgz ` | ||
--target_commitish $(Build.SourceBranchName); | ||
displayName: "Publish GitHub Release ${{ parameters.PackagePath }}" | ||
- ${{ if ne(parameters.PublishDevVersion, true) }}: | ||
- script: | | ||
cd packages/${{ parameters.PackagePath }} | ||
echo "//registry.npmjs.org/:_authToken=$(azure-sdk-npm-token)" > ./.npmrc | ||
npm publish --access public | ||
displayName: "Publish to npm ${{ parameters.PackagePath }}" |