diff --git a/eng/pipelines/publish-dev-release-go.yml b/eng/pipelines/publish-dev-release-go.yml deleted file mode 100644 index 6331c674c..000000000 --- a/eng/pipelines/publish-dev-release-go.yml +++ /dev/null @@ -1,23 +0,0 @@ -trigger: none -pr: none - -pool: - vmImage: "ubuntu-22.04" - -steps: - - template: /eng/pipelines/templates/steps/set-env.yaml - - - template: /eng/pipelines/templates/steps/build-test-go.yaml - - - pwsh: | - $currentVersion = node -p -e "require('$(System.DefaultWorkingDirectory)/packages/autorest.go/package.json').version"; - $currentVersion="$currentVersion-$(Build.BuildNumber)"; - cd packages/autorest.go - npm version --no-git-tag-version $currentVersion - npm pack; - npm install -g autorest-go-$currentVersion.tgz - if ($LASTEXITCODE) { - exit $LASTEXITCODE - } - npx publish-release --token $(package-write-token) --repo autorest.go --owner azure --name "Autorest for Go v$currentVersion" --tag v$currentVersion --notes='Preview version of Autorest for Go track 2' --prerelease --editRelease false --assets autorest-go-$currentVersion.tgz --target_commitish $(Build.SourceBranchName); - displayName: "Publish Dev Release" diff --git a/eng/pipelines/publish-dev-release-typespec.yml b/eng/pipelines/publish-dev-release-typespec.yml deleted file mode 100644 index 321414fd7..000000000 --- a/eng/pipelines/publish-dev-release-typespec.yml +++ /dev/null @@ -1,23 +0,0 @@ -trigger: none -pr: none - -pool: - vmImage: "ubuntu-22.04" - -steps: - - template: /eng/pipelines/templates/steps/set-env.yaml - - - template: /eng/pipelines/templates/steps/build-test-typespec.yaml - - - pwsh: | - $currentVersion = node -p -e "require('$(System.DefaultWorkingDirectory)/packages/typespec-go/package.json').version"; - $currentVersion="$currentVersion-$(Build.BuildNumber)"; - cd packages/typespec-go - npm version --no-git-tag-version $currentVersion - npm pack; - npm install -g azure-tools-typespec-go-$currentVersion.tgz - if ($LASTEXITCODE) { - exit $LASTEXITCODE - } - npx publish-release --token $(azuresdk-github-pat) --repo autorest.go --owner azure --name "TypeSpec emitter for Go v$currentVersion" --tag v$currentVersion --notes='Beta version of TypeSpec emitter for Go SDKs' --prerelease --editRelease false --assets azure-tools-typespec-go-$currentVersion.tgz --target_commitish $(Build.SourceBranchName); - displayName: "Publish Dev Release" diff --git a/eng/pipelines/publish-release-go.yml b/eng/pipelines/publish-release-go.yml deleted file mode 100644 index fc811caa4..000000000 --- a/eng/pipelines/publish-release-go.yml +++ /dev/null @@ -1,50 +0,0 @@ -trigger: none -pr: none - - -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/steps/set-env.yaml - - - template: /eng/steps/build-test-go.yaml - - - pwsh: | - $currentVersion = node -p -e "require('./packages/autorest.go/package.json').version"; - cd packages/autorest.go - npm version --no-git-tag-version $currentVersion - npm pack; - npm install -g autorest-go-$currentVersion.tgz - if ($LASTEXITCODE) { - exit $LASTEXITCODE - } - npx publish-release ` - --token $(azuresdk-github-pat) ` - --repo autorest.go ` - --owner azure ` - --name "Autorest for Go v$currentVersion" ` - --tag v$currentVersion --notes='Autorest for Go track 2' ` - --prerelease --editRelease false ` - --assets autorest-go-$currentVersion.tgz ` - --target_commitish $(Build.SourceBranchName); - displayName: "Publish GitHub Release" - - - script: | - cd packages/autorest.go - echo "//registry.npmjs.org/:_authToken=$(azure-sdk-npm-token)" > ./.npmrc - npm publish --access public - displayName: "Publish to npm" diff --git a/eng/pipelines/publish-release-gotest.yml b/eng/pipelines/publish-release-gotest.yml deleted file mode 100644 index b6328d2d6..000000000 --- a/eng/pipelines/publish-release-gotest.yml +++ /dev/null @@ -1,27 +0,0 @@ -trigger: none -pr: none - -pool: - vmImage: "ubuntu-22.04" - -steps: - - template: /eng/pipelines/templates/steps/set-env.yaml - parameters: - NodeVersion: "18.x" - GoVersion: "1.21.4" - - - template: /eng/pipelines/templates/steps/build-test-gotest.yaml - - - pwsh: | - $currentVersion = node -p -e "require('./packages/autorest.gotest/package.json').version"; - cd packages/autorest.gotest - npm version --no-git-tag-version $currentVersion - npm pack; - npx publish-release --token $(azuresdk-github-pat) --repo autorest.go --owner azure --name "@autorest/gotest_v$currentVersion" --tag v$currentVersion --notes='Go test generation' --editRelease false --assets autorest-gotest-$currentVersion.tgz --target_commitish $(Build.SourceBranchName); - displayName: "Publish GitHub Release" - - - script: | - cd packages/autorest.gotest - echo "//registry.npmjs.org/:_authToken=$(azure-sdk-npm-token)" > ./.npmrc - npm publish --access public - displayName: "Publish to npm" diff --git a/eng/pipelines/publish-release-typespec.yml b/eng/pipelines/publish-release-typespec.yml deleted file mode 100644 index 2a69f0d5e..000000000 --- a/eng/pipelines/publish-release-typespec.yml +++ /dev/null @@ -1,50 +0,0 @@ -trigger: none -pr: none - - -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/steps/set-env.yaml - - - template: /eng/steps/build-test-typespec.yaml - - - pwsh: | - $currentVersion = node -p -e "require('./packages/typespec-go/package.json').version"; - cd packages/typespec-go - npm version --no-git-tag-version $currentVersion - npm pack; - npm install -g azure-tools-typespec-go-$currentVersion.tgz - if ($LASTEXITCODE) { - exit $LASTEXITCODE - } - npx publish-release ` - --token $(azuresdk-github-pat) ` - --repo autorest.go ` - --owner azure ` - --name "TypeSpec emitter for Go SDKs v$currentVersion" ` - --tag v$currentVersion --notes='TypeSpec emitter for Go SDKs' ` - --prerelease --editRelease false ` - --assets azure-tools-typespec-go-$currentVersion.tgz ` - --target_commitish $(Build.SourceBranchName); - displayName: "Publish GitHub Release" - - - script: | - cd packages/typespec-go - echo "//registry.npmjs.org/:_authToken=$(azure-sdk-npm-token)" > ./.npmrc - npm publish --access public - displayName: "Publish to npm" diff --git a/eng/pipelines/publish-release.yml b/eng/pipelines/publish-release.yml new file mode 100644 index 000000000..31f203d0a --- /dev/null +++ b/eng/pipelines/publish-release.yml @@ -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 }} diff --git a/eng/pipelines/templates/steps/publish-release.yaml b/eng/pipelines/templates/steps/publish-release.yaml new file mode 100644 index 000000000..efa8af255 --- /dev/null +++ b/eng/pipelines/templates/steps/publish-release.yaml @@ -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 }}"