diff --git a/.azure-devops/graphitation-release.yml b/.azure-devops/graphitation-release.yml index d84f9aaff..22bdf866c 100644 --- a/.azure-devops/graphitation-release.yml +++ b/.azure-devops/graphitation-release.yml @@ -1,7 +1,6 @@ pr: none trigger: - main - - alloy/relay-apollo-duct-tape variables: - group: InfoSec-SecurityResults @@ -58,7 +57,14 @@ extends: git config user.name "Graphitation Service Account" git fetch --depth=2 displayName: Configure git for release - - script: yarn release -y -n $(ossNpmToken) --access public --no-push --keep-change-files + - script: | + releaseBranch="origin/${BUILD_SOURCEBRANCH#refs/heads/}" + + if [ "${BUILD_SOURCEBRANCH}" = "refs/heads/main" ]; then + yarn beachball publish -b "$releaseBranch" -t latest -y -n $(ossNpmToken) --access public --no-push --keep-change-files + else + yarn beachball publish -b "$releaseBranch" -t alpha --prerelease-prefix alpha -y -n $(ossNpmToken) --access public --no-push --keep-change-files + fi displayName: Release to the npm registry - script: | git restore . @@ -69,7 +75,14 @@ extends: - task: npmAuthenticate@0 inputs: workingFile: ".npmrc" - - script: yarn release -y --registry $(adoNpmFeedBaseUrl) + - script: | + releaseBranch="origin/${BUILD_SOURCEBRANCH#refs/heads/}" + + if [ "${BUILD_SOURCEBRANCH}" = "refs/heads/main" ]; then + yarn beachball publish -b "$releaseBranch" -t latest -y --registry $(adoNpmFeedBaseUrl) + else + yarn beachball publish -b "$releaseBranch" -t alpha --prerelease-prefix alpha -y --registry $(adoNpmFeedBaseUrl) + fi displayName: Release to the ado npm feed - task: 1ES.PublishPipelineArtifact@1 displayName: 📒 Publish Manifest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 41833ae5c..7f84b27b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,7 +54,17 @@ yarn lint ## Releasing alpha versions -1. Add a branch which will be releasing alpha version to .azure-devops\graphitation-release.yml into `trigger` -2. Change `release` script in the root package json to `yarn beachball publish -t alpha`, -3. Modify package.json of the package you want to release to x.x.x-alpha.0 -4. Every time you want to release a new version use `yarn change` and select `prelease`. To avoid patching of dependent packages set `dependentChangeType` to `none` manually in .changes directory +Generraly you need to only run pipeline [microsoft.graphitation](https://dev.azure.com/DomoreexpGithub/Github_Pipelines/_build?definitionId=8) and that is all. + +Here described detailed steps of the release process: + +1. Make sure you have generated change files for your changes using `yarn change` command. +1. In Azure DevOps run pipeline [microsoft.graphitation](https://dev.azure.com/DomoreexpGithub/Github_Pipelines/_build?definitionId=8) +1. Pipeline automatically adds the `alpha` tag and prefix to the version. +1. The package will be published to npm with the `alpha` tag, so you can install it using `npm i @graphitation/PACKAGE@VERSION-alpha.XX` +1. Bot push the bump commit to the branch. + +The core logic is `-b "$releaseBranch" -t alpha --prerelease-prefix alpha` flags for beachball publish command which are added in the [graphitation-release.yml](.azure-devops/graphitation-release.yml#L66) pipeline. + + + diff --git a/package.json b/package.json index 08170a49b..8e08810e3 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,9 @@ "lint": "lage lint --continue", "lage": "lage", "ci": "yarn lage build types test lint && yarn checkchange", - "beachball": "beachball -b origin/main", - "change": "yarn beachball change", - "checkchange": "yarn beachball check", - "release": "yarn beachball publish -t latest", + "beachball": "beachball", + "change": "yarn beachball -b origin/main change", + "checkchange": "yarn beachball -b origin/main check", "postinstall": "patch-package" }, "devDependencies": { @@ -49,4 +48,4 @@ "serialize-javascript": "^7.0.4", "webpack": "^5.105.4" } -} +} \ No newline at end of file