-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Dataport/polar into fix/nar…
…rower-type
- Loading branch information
Showing
11 changed files
with
385 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,8 @@ For these cases, this not-so-secret file denotes our not-anymore-arcane knowledg | |
|
||
1. Draw a dependency tree of POLAR packages with changes documented as `"unpublished"` in their respective `CHANGELOG.md` files. | ||
2. Start with the leafs. Update the version from `"unpublished"` to the appropriate version indicated by the nature of changes. If required, change the package.json dependencies to refer to minimum versions of dependencies used. | ||
3. Push to main. A pipeline is now running that detects the CHANGELOG change, updates the version, publishes the package to NPM, and creates a tag `@polar/[email protected]`. | ||
4. Create new release note on GitHub. Select the previously created tag, use it as title, and copy the relevant changelog. Link to the NPM package. If it's a client, add the NPM package to the artifacts for an easier download. See previous releases for formatting of contents and artifacts. | ||
3. Push to main. A pipeline is now running that detects the CHANGELOG change, updates the version, publishes the package to NPM, creates a tag `@polar/[email protected]`, and procudes a GitHub release. | ||
4. If it's a client, add the NPM package to the release artifacts for an easier download. See previous releases for formatting of contents and artifacts. | ||
5. Delete leafs from tree made in `1`. Go back to `2` until the tree is empty. | ||
|
||
## Update process | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
|
||
const fs = require('fs') | ||
const { getOctokit, context } = require('@actions/github') | ||
|
||
const tags = process.argv.slice(2) | ||
const github = getOctokit(process.env.GITHUB_TOKEN) | ||
const { owner, repo } = context.repo | ||
|
||
const camelize = (strings) => | ||
strings[0] + | ||
strings | ||
.slice(1) | ||
.map((string) => string.charAt(0).toUpperCase() + string.slice(1)) | ||
.join('') | ||
|
||
function getBody(tag) { | ||
const [packageName, packageVersion] = tag.split('@').slice(1) | ||
const name = packageName.split('/')[1] | ||
const nameParts = name.split('-') | ||
let filePath | ||
|
||
if (nameParts[0] === 'core' || nameParts[0] === 'components') { | ||
filePath = `./packages/${nameParts[0]}` | ||
} else if (name === 'lib-custom-types') { | ||
filePath = `./packages/types/custom` | ||
} else if (nameParts[0] === 'plugin' || nameParts[0] === 'client') { | ||
filePath = `./packages/${nameParts[0]}s/${camelize(nameParts.slice(1))}` | ||
} else if (nameParts[0] === 'lib') { | ||
filePath = `./packages/${nameParts[0]}/${camelize(nameParts.slice(1))}` | ||
} else { | ||
const message = `Unknown package name in tag ${tag}.` | ||
console.error(message) | ||
process.exit = 1 | ||
throw new Error(message) | ||
} | ||
const data = fs.readFileSync(`${filePath}/CHANGELOG.md`, { encoding: 'utf8' }) | ||
return `## CHANGELOG | ||
${data | ||
.split('##')[1] | ||
.split('\n') | ||
.slice(1) | ||
.join( | ||
'\n' | ||
)}[NPM package](https://www.npmjs.com/package/${packageName}/v/${packageVersion})` | ||
} | ||
|
||
for (const tag of tags) { | ||
github.request(`POST /repos/${owner}/${repo}/releases`, { | ||
owner, | ||
repo, | ||
tag_name: tag, | ||
name: tag, | ||
body: getBody(tag), | ||
headers: { | ||
'X-GitHub-Api-Version': '2022-11-28', | ||
}, | ||
}) | ||
} |