diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 60e98030c..6e8e5410c 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -8,6 +8,8 @@ jobs: Build: if: contains(github.event.head_commit.message, 'chore(release)') == false runs-on: ubuntu-latest + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} steps: - name: Checkout code uses: actions/checkout@v2 @@ -36,7 +38,9 @@ jobs: continue-on-error: true id: graduateRelease if: ${{ github.ref == 'refs/heads/main' }} - run: yarn release:prod:graduate + run: | + yarn release:prod:graduate + yarn publish:prod - name: Bump Prod Version Fallback if: ${{ always() && github.ref == 'refs/heads/main' && steps.graduateRelease.outcome == 'failure' }} @@ -44,7 +48,10 @@ jobs: echo Falling back to non-graduate release due to https://github.com/lerna/lerna/issues/2532 git stash yarn release:prod + yarn publish:prod - name: Bump Beta Version if: ${{ github.ref == 'refs/heads/develop' }} - run: yarn release:beta + run: | + yarn release:beta + yarn publish:beta diff --git a/package.json b/package.json index 69fcfb7a8..829a88e2a 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,8 @@ "release:prod": "lerna version --conventional-commits --yes -m \"chore(release): publish\"", "release:prod:graduate": "lerna version --conventional-graduate --conventional-commits --yes -m \"chore(release): publish\"", "release:beta": "lerna version --conventional-prerelease --conventional-commits --yes -m \"chore(release): publish\"", + "publish:prod": "lerna publish from-git --yes", + "publish:beta": "lerna publish from-git --yes --dist-tag alpha", "version": "yarn install --no-immutable && git add yarn.lock", "postversion": "./scripts/push-tags-one-by-one.sh", "lerna:list": " yarn lerna list -all", diff --git a/packages/releases/dist/releases.json b/packages/releases/dist/releases.json new file mode 100644 index 000000000..b9506d25d --- /dev/null +++ b/packages/releases/dist/releases.json @@ -0,0 +1,6 @@ +{ + "@standardnotes/components-meta": "2.1.6", + "@standardnotes/desktop": "3.22.12-alpha.2", + "@standardnotes/mobile": "3.23.8-alpha.0", + "@standardnotes/web": "3.23.0-alpha.1" +} \ No newline at end of file diff --git a/packages/releases/index.mjs b/packages/releases/index.mjs new file mode 100644 index 000000000..4e8923b26 --- /dev/null +++ b/packages/releases/index.mjs @@ -0,0 +1,15 @@ +import Components from '../components/package.json' assert { type: 'json' } +import Desktop from '../desktop/package.json' assert { type: 'json' } +import Mobile from '../mobile/package.json' assert { type: 'json' } +import Web from '../web/package.json' assert { type: 'json' } +import { writeJson, ensureDirExists } from '../../scripts/ScriptUtils.mjs' + +const Releases = { + [Components.name]: Components.version, + [Desktop.name]: Desktop.version, + [Mobile.name]: Mobile.version, + [Web.name]: Web.version, +} + +ensureDirExists('dist') +writeJson(Releases, 'dist/releases.json') diff --git a/packages/releases/package.json b/packages/releases/package.json new file mode 100644 index 000000000..588a72e40 --- /dev/null +++ b/packages/releases/package.json @@ -0,0 +1,23 @@ +{ + "name": "@standardnotes/releases", + "version": "1.0.0", + "license": "AGPL-3.0-or-later", + "main": "dist/releases.json", + "private": false, + "publishConfig": { + "access": "public" + }, + "author": "Standard Notes", + "description": "Standard Notes client release versions", + "engines": { + "node": ">=12.19.0 <17.0.0" + }, + "scripts": { + "build": "node index.mjs", + "version": "yarn build" + }, + "devDependencies": { + "@types/node": "*", + "typescript": "*" + } +} diff --git a/scripts/ScriptUtils.mjs b/scripts/ScriptUtils.mjs index 2c5278013..ce7a47c86 100644 --- a/scripts/ScriptUtils.mjs +++ b/scripts/ScriptUtils.mjs @@ -23,3 +23,8 @@ export const emptyExistingDir = (dir) => { export const listDirFiles = (dir) => { return fs.readdirSync(dir) } + +export const writeJson = (data, path) => { + const string = JSON.stringify(data, null, 2) + return fs.writeFileSync(path, string) +} diff --git a/yarn.lock b/yarn.lock index 9d509df1b..525db0840 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5789,6 +5789,15 @@ __metadata: languageName: node linkType: hard +"@standardnotes/releases@workspace:packages/releases": + version: 0.0.0-use.local + resolution: "@standardnotes/releases@workspace:packages/releases" + dependencies: + "@types/node": "*" + typescript: "*" + languageName: unknown + linkType: soft + "@standardnotes/responses@npm:^1.6.36": version: 1.6.36 resolution: "@standardnotes/responses@npm:1.6.36"