Skip to content

Commit

Permalink
chore: Refactor release-please config for versioning/release process …
Browse files Browse the repository at this point in the history
…changes (#1246)

Updated release-please config to make use of latest features and improve our versioning/release process.

Requirements:

- Calendar versioned packages:
  - Must follow Looker’s major and minor calendar versioning of the API spec they’ve pulled in, even if the package’s changes are only dependencies with version bumps. E.g. if Looker API spec version is at 23.12.x, then sdk is at 23.12.x, AND extension-sdk must be at 23.12.x even if it has no changes outside of its sdk dependency version bump.
    - We make use of release-please manifest plugin “linked-versions” to sync all calendar versioned packages versions. Now instead of editing the config file, the sdk gen commit should have “Release-As:X.X.X” in the commit body to force calendar versioning. As long as the commit touches at least one file in at least one calendar versioned package it will force all calendar version packages to that version. There is a caveat to using linked-version. If we patch bump any of the linked packages, they will all match the highest version, however this is not too big od a deal, as it is the major/minor that matters, and the linked-version plugin saves us complexity in our release process and config file.
  - Update patch number for any changes not associated with a Looker release.
    - We use package scoped "versioning": "always-bump-patch" to keep any changes from turning into minor or major bumps. Now for any sdk changes in between Looker releases, you only need to make/merge the changes with a conventional commit title, and merge the resulting release PR.

- Semantically versioned packages:
  - Release-please naturally does semver on packages by default.
  - Should bump patch number if its dependency has a version bump. 
    - Node workspace plugin automatically patch bumps any package if its dependencies are updated.

Outside of all that, also cleaned up the extra "release-as"'s since we dont need them anymore and updated sdk_gen to set "release-as" git commit body footer to calendar version.
  • Loading branch information
jeremytchang authored Feb 13, 2023
1 parent 0150019 commit ab3c9e9
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 112 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/reset-versions.yml

This file was deleted.

29 changes: 1 addition & 28 deletions bin/sdk_gen
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const utf8 = { encoding: 'utf-8' }

const root = path.join(__dirname, '/../')
let sdk = looker.LookerNodeSDK.init40()
const releaseConfig = path.join(root, 'release-please-config.json')

async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
Expand Down Expand Up @@ -71,31 +70,6 @@ const run = (command) => {
return result
}

/**
* Updates release-please-config.json to stamp the correct CalVer for the SDKs
*
* if `release-as` is already set, CalVer patch will be bumped if the current
* version is the same as the requested release version. Otherwise, it will be
* set to CalVer.0
*
* @param release Looker version
* @returns string describing CalVer action
*/
const releasePlease = (release) => {
const config = JSON.parse(fs.readFileSync(releaseConfig, utf8))
let newVer = `${release}.0`
const calVer = config[`release-as`]
if (calVer === newVer) {
const patch = parseInt(calVer.split('.')[2]) + 1
newVer = `${release}.${patch}`
}
config['release-as'] = newVer
fs.writeFileSync(releaseConfig, JSON.stringify(config, null, 2), utf8)
const result = `set release please calVer to ${newVer}`
console.info(result)
return result
}

/**
* Run multiple commands one after another, returning on first failure
*
Expand Down Expand Up @@ -214,11 +188,10 @@ const regen = async (release) => {
const branch = branchActive()
if (await pullci(release)) {
return batch([
(release) => releasePlease(release),
'yarn gen',
'bin/smoke typescript python kotlin',
'git add -A',
`git commit -m "feat: generate SDKs for Looker ${release}"`,
`git commit -m "feat: generate SDKs for Looker ${release}" -m "Release-As: ${release}.0`,
`git push origin ${branch}`,
/* create PR
*/
Expand Down
83 changes: 43 additions & 40 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,53 @@
{
"plugins": [
"node-workspace"
],
"plugins": [{
"type": "node-workspace",
"merge": false
},{
"type":"linked-versions",
"group-name": "calendar versioned sdks",
"components": [
"extension-sdk",
"extension-sdk-react",
"sdk",
"sdk-node",
"looker_sdk"
]
}],
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"packages": {
".": {
"release-as": ""
},
"packages/api-explorer": {
"release-as": ""
},
"packages/code-editor": {
"release-as": ""
},
".": {},
"packages/api-explorer": {},
"packages/code-editor": {},
"packages/extension-api-explorer": {},
"packages/extension-sdk": {},
"packages/extension-sdk-react": {},
"packages/extension-utils": {
"release-as": ""
},
"packages/hackathon": {},
"packages/run-it": {
"release-as": ""
"packages/extension-sdk": {
"component": "extension-sdk",
"versioning": "always-bump-patch"
},
"packages/sdk": {},
"packages/sdk-codegen": {
"release-as": ""
},
"packages/sdk-codegen-scripts": {
"release-as": ""
},
"packages/sdk-codegen-utils": {
"release-as": ""
},
"packages/sdk-node": {},
"packages/sdk-rtl": {
"release-as": ""
},
"packages/wholly-sheet": {
"release-as": ""
"packages/extension-sdk-react": {
"component": "extension-sdk-react",
"versioning": "always-bump-patch"
},
"packages/extension-utils": {},
"packages/hackathon": {},
"packages/run-it": {},
"packages/sdk": {
"component": "sdk",
"versioning": "always-bump-patch"
},
"packages/sdk-codegen": {},
"packages/sdk-codegen-scripts": {},
"packages/sdk-codegen-utils": {},
"packages/sdk-node": {
"component": "sdk-node",
"versioning": "always-bump-patch"
},
"packages/sdk-rtl": {},
"packages/wholly-sheet": {},
"python": {
"release-type": "python",
"package-name": "looker_sdk"
"component": "looker_sdk",
"versioning": "always-bump-patch",
"release-type": "python"
}
},
"release-as": "23.0.0"
}
}

0 comments on commit ab3c9e9

Please sign in to comment.