Skip to content

Commit

Permalink
Merge branch 'main' into fix/narrower-type
Browse files Browse the repository at this point in the history
  • Loading branch information
dopenguin authored Feb 2, 2024
2 parents 23a591b + 91f0a00 commit df436fa
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.TAGS }}
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -17,10 +19,19 @@ jobs:
node-version: 18.13.0
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run publishPackages
- run: echo "TAGS=$(node ./scripts/publishPackages)" >> $GITHUB_ENV
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: EndBug/add-and-commit@v9
with:
author_name: Dataport Geo Bot
author_email: [email protected]
- run: |
for TAG in ${{ env.TAGS }}
do
git config user.name "Dataport Geo Bot"
git config user.email "[email protected]"
git tag $TAG
git push origin $TAG
echo "Released and tagged $TAG"
done
Binary file added .hack.sh.swp
Binary file not shown.
7 changes: 3 additions & 4 deletions arcana.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ 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, and publishes the package to NPM.
4. Pull. Tag the last commit with `git tag @polar/[email protected]` appropriately for all packages released in that commit. `git push --tags` to push tags to GitHub.
5. 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.
6. Delete leafs from tree made in `1`. Go back to `2` until the tree is empty.
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.
5. Delete leafs from tree made in `1`. Go back to `2` until the tree is empty.

## Update process

Expand Down
15 changes: 12 additions & 3 deletions scripts/publishPackages.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const cp = require('child_process')
const fs = require('fs')
const packages = require('./packages')

const tags = []

function checkForNewVersion(cwd) {
const { version } = JSON.parse(
fs.readFileSync(cwd + '/package.json', { encoding: 'UTF-8' })
Expand All @@ -18,6 +20,13 @@ function checkForNewVersion(cwd) {
}
}

function getPackageName(cwd) {
const { name } = JSON.parse(
fs.readFileSync(cwd + '/package.json', { encoding: 'UTF-8' })
)
return name
}

for (const path of packages) {
try {
const nextVersion = checkForNewVersion(path)
Expand All @@ -30,12 +39,12 @@ for (const path of packages) {
{ cwd: path }
)
cp.execSync('npm publish --access=public', context)
console.info(`The package in '${path}' was published as v${nextVersion}.`)
} else {
console.info("No update in '" + path + "'.")
tags.push(`${getPackageName(path)}@${nextVersion}`)
}
} catch (e) {
console.error(e)
process.exitCode = 1
}
}

process.stdout.write(tags.join(' '))

0 comments on commit df436fa

Please sign in to comment.