selflow / selflow

A Workflow Orchestration Framework built to be self-hosted
https://selflow.github.io/selflow/
Apache License 2.0
7 stars 2 forks source link

Release management #53

Open Anthony-Jhoiro opened 1 year ago

Anthony-Jhoiro commented 1 year ago

Release Management

To make the Selflow project usable by most, a string release system to track changes is required.

This repository is a monorepo that contains the code of multiple applications, plugins, libraries, and core libraries. They should share the same release cycle because they are all part of the Selflow ecosystem, and it can help track the updates.

This issue is still a draft, but I am already open to your feedbacks

Requirements:

These requirements can be subject to change if better ideas are suggested !

I am, of course, open to suggestions!

Draft ideas:

Tools to test

sylvain-lavazais commented 1 year ago

here an idea to test with:

semantic-release (https://github.com/semantic-release/semantic-release) can define you own release cycle by using some modules that fulfil all steps of a release (https://github.com/semantic-release/semantic-release#release-steps)

for each steps semantic-release provide a bunch of plugins with, for some of them, many configuration possible.

for the step analyzeCommits the plugins commit-analyzer (https://github.com/semantic-release/commit-analyzer) can be set-up with configurations on scope and release kind.

https://github.com/semantic-release/commit-analyzer#releaserules

Therefor, it should be possible to accomplish a solution that fit your need.

Anthony-Jhoiro commented 1 year ago

Thanks for your answer @lavazais-sylvain! I did a small POC to test this. This was my process:

In paper, this should be working fine, this is the resulting code

.release.js ```js //..... module.exports = { branches: ["master", "main"], plugins: [ [ "./custom-plugin.js", { releaseRules: { major: [":boom:"], minor: [":sparkles:"], patch: [ ":bug:", ":ambulance:", ":lock:", ":lipstick:", ":zap:", ":globe_with_meridians:", ":alien:", ":wheelchair:", ":loud_sound:", ":mute:", ":children_crossing:", ":speech_balloon:", ":iphone:", ":pencil2:", ":bento:", ":green_apple:", ":green_heart:", ], }, }, ], //.... ], }; ```
./custom-plugin.js ```js const {analyzeCommits: gitmojiAnalyzeCommits} = require("semantic-release-gitmoji"); const {spawnSync} = require('child_process'); async function analyzeCommits(pluginConfig, context) { const {commits, logger} = context; /** * @type {string} */ const releaseType = gitmojiAnalyzeCommits(pluginConfig, context); if (!releaseType) { logger.log("No release is needed") return null; } const {stdout} = await spawnSync('yarn -s nx show projects --affected | xargs -I % bash -c "yarn -s nx show project % --json" | jq -n \'[ inputs.tags ]\'', { shell: "/bin/bash", env: { NX_HEAD: commits[0].commit.long, NX_BASE: commits[commits.length - 1].commit.long, } }) const tags = JSON.parse(stdout.toString()).flat() const isCore = tags.includes("scope:core") if (isCore) { logger.log(`Core Release ${releaseType}`) return releaseType } return "prerelease"; } module.exports = { analyzeCommits } ```

The resulting issue is that semantic-release restrict commitAnalyzer plugins to only return major, minor, and patch release and not prerelease... So it returns an error image

I didn't try with a scope and the karma-commit convention yet but the limitation is hard-coded in the semantic-release code, so it does not seem possible to use it to handle pre-release this way. It allows pre-release but only for branches wich I don't think is well suited for the problem