lluchmk / semantic-release-ado Goto Github PK
View Code? Open in Web Editor NEWSemantic release plugin for automatic releases on Azure DevOps pipelines.
License: MIT License
Semantic release plugin for automatic releases on Azure DevOps pipelines.
License: MIT License
Having some issues when installing this plugin
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @dignisia/[email protected]
npm ERR! Found: @semantic-release/[email protected]
npm ERR! node_modules/@semantic-release/changelog
npm ERR! @semantic-release/changelog@"6.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @semantic-release/changelog@"6.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/semantic-release
npm ERR! peer semantic-release@">=18.0.0" from @semantic-release/[email protected]
npm ERR! node_modules/@semantic-release/changelog
npm ERR! @semantic-release/changelog@"6.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/viktorsarstrom/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
Should probably bump it to 18.0.x (9?)?
semantic-release-ado/package.json
Line 34 in 2a09ef0
Hello, I'm having some trouble and I hope you can help me resolve it.
If we're following the configuration example for jobs and outputting of nextRelease it always comes out either empty or won't even pass the pipeline if we straight up use the code sample.
Perhaps I am missing something?
My powershell output variable task fails on $(nextRelease) and all echos don't show anything
Code used:
- job: Tag_Release
displayName: Tag release
pool:
vmImage: 'vs2017-win2016'
steps:
- script: >
npx
-p semantic-release
-p @semantic-release/git
-p semantic-release-ado
semantic-release
displayName: 'Tag release (semantic)'
env: { GH_TOKEN: $(GitHubToken) }
- script: echo $(nextRelease) <- tried various combination of outputting and no result
# Output version number to be available to other jobs
- powershell: |
echo "##vso[task.setvariable variable=versionNumber;isOutput=true]$(nextRelease)" <-- This fails. Tried $env:nextRelease
name: versionOutput
displayName: Release version output
My pipeline output is
[7:11:10 AM] [semantic-release] › ℹ Running semantic-release version 17.2.2
[7:11:11 AM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/npm"
[7:11:11 AM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/github"
[7:11:11 AM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[7:11:11 AM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[7:11:11 AM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/npm"
[7:11:11 AM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/npm"
[7:11:11 AM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/github"
[7:11:11 AM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm"
[7:11:11 AM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/github"
[7:11:11 AM] [semantic-release] › ✔ Loaded plugin "success" from "@semantic-release/github"
[7:11:11 AM] [semantic-release] › ✔ Loaded plugin "fail" from "@semantic-release/github"
[7:11:15 AM] [semantic-release] › ✔ Run automated release from branch main on repository https://[secure]@github.com/maranmaran/Pricely-protobuf-monorepo
[7:11:16 AM] [semantic-release] › ✔ Allowed to push to the Git repository
[7:11:16 AM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/npm"
[7:11:16 AM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/npm"
[7:11:16 AM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/github"
[7:11:16 AM] [semantic-release] [@semantic-release/github] › ℹ Verify GitHub authentication
[7:11:17 AM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/github"
[7:11:17 AM] [semantic-release] › ℹ Found git tag v1.3.1 associated with version 1.3.1 on branch main
[7:11:17 AM] [semantic-release] › ℹ Found 2 commits since last release
[7:11:17 AM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[7:11:17 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analyzing commit: no message
[7:11:17 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ The commit should not trigger a release
[7:11:17 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analyzing commit: feat: install
[7:11:17 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ The release type for the commit is minor
[7:11:17 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analysis of 2 commits complete: minor release
[7:11:17 AM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
I don't see semantic-release-ado being loaded as plugin :/
Fixed it with proper package.json config
"release": {
"branches": [ "main" ],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/changelog",
"@semantic-release/git",
"semantic-release-ado"
]
}
npx
-p semantic-release
-p @semantic-release/changelog
-p @semantic-release/git
-p semantic-release-ado
semantic-release
How exactly should I authenticate to my Azure DevOps repo?
Currently running into the following error:
[4:22:40 PM] [semantic-release] › ℹ Running semantic-release version 17.1.1
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/changelog"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/github"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/git"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "semantic-release-ado"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/changelog"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/git"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "semantic-release-ado"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/github"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/github"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "success" from "@semantic-release/github"
[4:22:40 PM] [semantic-release] › ✔ Loaded plugin "fail" from "@semantic-release/github"
[4:22:40 PM] [semantic-release] › ✖ An error occurred while running semantic-release: Error: Command failed with exit code 128: git ls-remote --heads https://[secure]@dev.azure.com/<orgName>/Versioning/_git/Versioning
fatal: Authentication failed for 'https://dev.azure.com/<orgName>/Versioning/_git/Versioning/'
My pipeline:
trigger: none
jobs:
- job: Build
pool:
vmImage: 'ubuntu-latest'
steps:
- script: >
npx -p semantic-release
-p @semantic-release/changelog
-p @semantic-release/git
-p semantic-release-ado
semantic-release
env: { GH_TOKEN: $(GitHubToken) }
displayName: 'Semantic release'
- script: echo $(nextRelease)
displayName: 'Show next version'
I'm guessing the GH_TOKEN
environment variable is wrong, as I'm trying to authenticate to AzDo, not GitHub?
It appears that semantic-release doesn't run prepare, publish, success and fail when the dry-run option is set.
Versions 1.0.x didn't set the nextRelease
variable when there's no relevant changes. 1.1.0 changed this behavior, setting the value to the previous versions.
A configuration option should be added to allow configuring this behavior.
Original comment:
I understand this feature but I was using the empty state of the nextRelease
variable if there is no relevant change. Do you think it is possible to add an option to enable/disable this new feature. It would be great! Thank you all!
Originally posted by @panquez in #2 (comment)
Hi guys
Does sematic-release-ado generate CHANGELOG as well? if yes, is it using conventional-changelog-config-spec ?
Best
Hmendezm
In our configuration, we have setOnlyOnRelease
to false. We are trying to figure out how we'd go about tagging our build artifact to indicate that it is a releasable build. This is trivial with setOnlyOnRelease
set to true as we'd simply check for the existence of nextRelease
variable.
However, we set setOnlyOnRelease
to false so that we can get the current version number regardless of if there is a new release.
Considering this, would it make sense to add a mechanism to indicate if there was a release beyond the calculated version number being present in the variable?
Changing the value of the nextRelease
variable would introduce a breaking change. To avoid that, perhaps a second variable could be set instead, if a breaking change is not desired. Variable name proposal would be releasable
, and potentially configurable as well.
For example:
analyzeCommits.js
module.exports = async (pluginConfig, { lastRelease: { version }, logger }) => {
const setOnlyOnRelease = pluginConfig.setOnlyOnRelease === undefined ? true : !!pluginConfig.setOnlyOnRelease
if (!setOnlyOnRelease) {
const varName = pluginConfig.varName || 'nextRelease'
const isOutput = pluginConfig.isOutput|| false
logger.log(`Setting current version ${version} to the env var ${varName}`)
console.log(`##vso[task.setvariable variable=${varName};isOutput=${isOutput}]${version}`)
console.log(`##vso[task.setvariable variable=releasable;isOutput=${isOutput}]false`);
}
}
verifyRelease.js
module.exports = async (pluginConfig, { nextRelease: { version }, logger }) => {
const varName = pluginConfig.varName || 'nextRelease'
const isOutput = pluginConfig.isOutput || false
logger.log(`Setting version ${version} to the env var ${varName}`)
console.log(`##vso[task.setvariable variable=${varName};isOutput=${isOutput}]${version}`)
console.log(`##vso[task.setvariable variable=releasable;isOutput=${isOutput}]true`);
}
I suppose it might be possible to add the plugin twice to the semantic-release configuration, each with a different semantic-release-ado configuration. One would have setOnlyOnRelease
false with the default variable name, and the other with setOnlyOnRelease
true and the variable name configured as my proposed releasable
.
I'm not sure if that is allowed or not by the semantic-release config. I will give it a try and report back.
Perhaps there is a completely different way I should be going about figuring out if my build is releasable or not. Our release cycle releases to NPM in this case, so we can't re-publish previous versions.
Thanks for the work on this plugin.
Hello, can't get remantic-release-ado working with the latest semantic-release library.
It fails with an error ##[error]TF209010
LOG:
[8:42:42 PM] [semantic-release] › ✔ Published release 1.2.2 on default channel
Async Command Start: Update Build Number
Async Command End: Update Build Number
##[error]TF209010: The build number format $(nextRelease)" contains invalid character(s), is too long, or ends with '.'. The maximum length of a build number is 255 characters. Characters which are not allowed include '"', '/', ':', '<', '>', '\', '|', '?', '@', and '*'.
Finishing: Release
Here is my pipeline:
- bash: |
npm install -g semantic-release @semantic-release/exec semantic-release-plus @semantic-release-plus/docker semantic-release-ado
semantic-release
displayName: 'Release'
env:
GITHUB_TOKEN: $(GH_TOKEN)
DOCKER_REPOSITORY_NAME: $(DOCKER_REPOSITORY_NAME)
DOCKER_REPOSITORY: $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/$(DOCKER_REPOSITORY_NAME)
Please, help!
- script: |
npx \
-p semantic-release-yaml \
-p semantic-release-ado \
-p @semantic-release/changelog \
semantic-release
contents="$(jq '.version = "$(nextRelease)"' package.json)" && \
echo -E "${contents}" > package.json
The above example doesn't work. I have to put the last two lines in a separate pipeline script in order to get a value inside the variable nextRelease
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.