diff --git a/.changeset/dull-feet-hear.md b/.changeset/dull-feet-hear.md new file mode 100644 index 000000000..a845151cc --- /dev/null +++ b/.changeset/dull-feet-hear.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 000000000..bacd7f219 --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,14 @@ +{ + "mode": "exit", + "tag": "beta", + "initialVersions": { + "@celo/odis-identifiers": "0.0.1", + "@celo/phone-number-privacy-combiner": "3.3.1", + "@celo/phone-number-privacy-common": "3.1.0", + "@celo/phone-number-privacy-monitor": "3.0.1", + "@celo/phone-number-privacy-signer": "3.1.0", + "@celo/encrypted-backup": "5.0.4", + "@celo/identity": "5.0.4" + }, + "changesets": [] +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6e3281732..2e76fa588 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,5 +10,21 @@ updates: schedule: day: "monday" interval: "weekly" - # To be added when a package manager decision has been taken - # - package-ecosystem: "npm" / "pnpm" # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem + - package-ecosystem: "npm" # is value for yarn + directory: "/" + schedule: + day: "monday" + interval: "weekly" + groups: + development-dependencies: + dependency-type: "development" + update-types: + - "minor" + - "patch" + production-dependencies: + dependency-type: "production" + update-types: + - "minor" + - "patch" + labels: + - "dependencies" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c737b754a..d460f4f62 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,8 +49,4 @@ jobs: NPM_TOKEN: ${{ env.NPM_TOKEN }} with: # This expects you to have a script called release which does a build for your packages and calls changeset publish - publish: yarn release - - name: Remove Yarn - # https://github.com/actions/setup-node/issues/182 - if: always() - run: npm uninstall -g yarn \ No newline at end of file + publish: yarn release \ No newline at end of file diff --git a/.github/workflows/social-connect.yml b/.github/workflows/social-connect.yml index ecd2d09b7..27491ecfe 100644 --- a/.github/workflows/social-connect.yml +++ b/.github/workflows/social-connect.yml @@ -8,9 +8,11 @@ on: push: branches: - main + - changeset-release/prerelease/* pull_request: branches: - main + - prerelease/* concurrency: group: social-connect-${{ github.ref }} diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..2f9c57182 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +. "$(dirname -- "$0")/_/husky.sh" + +yarn pretty-quick --staged --pattern '**/*.+(ts|js)' + +bash scripts/prereleasecheck.sh diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100644 index 000000000..fd083524c --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +. "$(dirname -- "$0")/_/husky.sh" + +bash scripts/prereleasecheck.sh diff --git a/RELEASE.md b/RELEASE.md index bae54a291..531a9fe4b 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -19,29 +19,19 @@ Each time a changeset is merged into main a "Version Packages" PR will automatic ## For pre releasing -changesets has 2 strategies for pre release versions. +For Detailed Steps read scripts/beta-mode.sh -The first is to enter `pre` mode on changesets. [docs here](https://github.com/changesets/changesets/blob/main/docs/prereleases.md) +1. Run `yarn beta-enter` +This will enter into the pre mode of changesets and create a prerelease/beta branch and push it up to origin(github) -``` -yarn changeset pre enter beta -yarn changeset version -git add . -git commit -m "Enter prerelease mode and version packages" -yarn changeset publish -git push --follow-tags -``` +Any time a commit is pushed to prerelease/** github will go and open a specially Version Packages (Beta) PR. You can merge this and packages will be published as specified in the branch (should be beta) -The other is to append --snapshot. which is great for daily releases. +2. If you need to release another beta make a changeset and commit it up. -``` -yarn changeset version --snapshot canary +3. When done run `yarn beta-exit` +This will exit changeset pre mode. Push up. -yarn changeset publish --no-git-tag --snapshot - -``` - - +4. Now you can Open a Pr with your prerelease/? branch against main. ## Package Versioning diff --git a/package.json b/package.json index a8c7a67e5..5f8c9d1f3 100644 --- a/package.json +++ b/package.json @@ -23,12 +23,10 @@ "test:watch": "node node_modules/jest/bin/jest.js --watch", "cs": "yarn changeset", "bump": "yarn changeset version", - "release": "yarn build && yarn cs publish" - }, - "husky": { - "hooks": { - "pre-commit": "pretty-quick --staged --pattern '**/*.+(ts|js)'" - } + "release": "yarn build && yarn cs publish", + "beta-enter": "bash scripts/beta-mode.sh", + "beta-exit": "yarn cs pre exit && git commit -am 'Complete beta releasing'", + "postinstall": "yarn husky install && yarn workspaces foreach --all -piv run postinstall" }, "workspaces": [ "packages/*", @@ -53,7 +51,7 @@ "eslint": "^8.50.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.0", - "husky": "^3.1.0", + "husky": "^8.0.0", "jest": "^29.0.2", "jest-circus": "^29.0.2", "jest-junit": "^14.0.1", diff --git a/scripts/beta-mode.sh b/scripts/beta-mode.sh new file mode 100644 index 000000000..84be97252 --- /dev/null +++ b/scripts/beta-mode.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# Beta Workflow steps +# 0. Enter any random branch name +echo "Enter a branch name" +read branch_name +# 1. create a prerelease/random branch +git branch prerelease/$branch_name +# 2. check it out +git checkout prerelease/$branch_name +# 3. enter pre mode (beta) +yarn cs pre enter beta +# 4. commit +git add .changeset/pre.json +git commit -am "enter beta mode" +# 5. push +git push origin prerelease/$branch_name +# 6. githhub action will automatically trigger and open a Version packages (beta) PR against the prerelease/random branch +echo "Commit to this prerelease/$branch_name and push up will trigger the github action to open a Version packages (beta) PR" +# 7. merge that PR to publish or Push up more commits to update +echo "Merge the Version Packages (beta) PR to publish a beta" +# a. if you do merge/publish you will need to add more changesets to initiate a new beta being published +# 8. repeat 7 if wanted +# 9. when ready to exit pre mode. `yarn beta-exit` +echo "when complete with beta mode, run `yarn beta-exit`" +echo "IMPORTANT: once you exit pre mode you should open a PR to merge your branch into main." +echo "DONT MERGE the Version Packages PR which is not Beta into prerelease/$branch_name branch" +# 11. open PR for prerelease into main +# NOTE: if you want to exit pre mode and not publish a beta, you can run `yarn beta-exit --no-publis +# TODO right now if you merge the changeset-prerelease Version Packages PR into its BASE it might be possible to end up in a state where pre mode is exited and you merge version packages in and end up pubblishing a regular package +exit 0 diff --git a/scripts/prereleasecheck.sh b/scripts/prereleasecheck.sh new file mode 100644 index 000000000..e83235a11 --- /dev/null +++ b/scripts/prereleasecheck.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +BRANCH="$(git rev-parse --abbrev-ref HEAD)" + +# Ensure that its not possible to commit to a prerelease branch without a pre.json file +if [[ $BRANCH == prerelease* ]]; then + echo "checking for pre.json" + PRE_FILE=.changeset/pre.json + if test -f "$PRE_FILE"; then + echo "$PRE_FILE exists." + else + echo "$PRE_FILE does not exist. Run yarn beta-enter to create it." + exit 1 + fi +fi \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 28e599072..33a150f61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10290,7 +10290,7 @@ __metadata: languageName: node linkType: hard -"cosmiconfig@npm:^5.0.5, cosmiconfig@npm:^5.1.0, cosmiconfig@npm:^5.2.1": +"cosmiconfig@npm:^5.0.5, cosmiconfig@npm:^5.1.0": version: 5.2.1 resolution: "cosmiconfig@npm:5.2.1" dependencies: @@ -13205,13 +13205,6 @@ __metadata: languageName: node linkType: hard -"get-stdin@npm:^7.0.0": - version: 7.0.0 - resolution: "get-stdin@npm:7.0.0" - checksum: a24ab2cf8ee35bf5d3460c0d8145f2624715d864485789b7101a7cf1b6c1ce0a57319e25304872074121fa60e7104f1af3583a7014e9974c84c61d0702beae24 - languageName: node - linkType: hard - "get-stream@npm:^4.0.0, get-stream@npm:^4.1.0": version: 4.1.0 resolution: "get-stream@npm:4.1.0" @@ -14020,25 +14013,12 @@ __metadata: languageName: node linkType: hard -"husky@npm:^3.1.0": - version: 3.1.0 - resolution: "husky@npm:3.1.0" - dependencies: - chalk: "npm:^2.4.2" - ci-info: "npm:^2.0.0" - cosmiconfig: "npm:^5.2.1" - execa: "npm:^1.0.0" - get-stdin: "npm:^7.0.0" - opencollective-postinstall: "npm:^2.0.2" - pkg-dir: "npm:^4.2.0" - please-upgrade-node: "npm:^3.2.0" - read-pkg: "npm:^5.2.0" - run-node: "npm:^1.0.0" - slash: "npm:^3.0.0" +"husky@npm:^8.0.0": + version: 8.0.3 + resolution: "husky@npm:8.0.3" bin: - husky-run: ./run.js - husky-upgrade: ./lib/upgrader/bin.js - checksum: bd2934f5992b6a3d8c6bc077fbd808fc41368241942d39749ff9d2ac7e0cc18736c16c6a193fa9dc2843cb9f69dd227c8a828e20c4babab437a2f7e2fd779110 + husky: lib/bin.js + checksum: b754cf70fdc97c3b60fec5b80056b9c11436464953b1691bf2b5dcf0081fb6685d2c5f47abb8b2b1c49f504aabea5321fdd6496f8b755d9f6e7525a493406abb languageName: node linkType: hard @@ -18602,7 +18582,7 @@ __metadata: eslint: "npm:^8.50.0" eslint-config-prettier: "npm:^9.0.0" eslint-plugin-prettier: "npm:^5.0.0" - husky: "npm:^3.1.0" + husky: "npm:^8.0.0" jest: "npm:^29.0.2" jest-circus: "npm:^29.0.2" jest-junit: "npm:^14.0.1" @@ -18751,15 +18731,6 @@ __metadata: languageName: node linkType: hard -"opencollective-postinstall@npm:^2.0.2": - version: 2.0.3 - resolution: "opencollective-postinstall@npm:2.0.3" - bin: - opencollective-postinstall: index.js - checksum: 69d63778087cd10c9d707d9ed360556780cfdd0cd6241ded0e26632f467f1d5a064f4a9aec19a30c187770c17adba034d988f7684b226f3a73e79f44e73fab0e - languageName: node - linkType: hard - "opentracing@npm:^0.14.4": version: 0.14.7 resolution: "opentracing@npm:0.14.7" @@ -19419,15 +19390,6 @@ __metadata: languageName: node linkType: hard -"please-upgrade-node@npm:^3.2.0": - version: 3.2.0 - resolution: "please-upgrade-node@npm:3.2.0" - dependencies: - semver-compare: "npm:^1.0.0" - checksum: d87c41581a2a022fbe25965a97006238cd9b8cbbf49b39f78d262548149a9d30bd2bdf35fec3d810e0001e630cd46ef13c7e19c389dea8de7e64db271a2381bb - languageName: node - linkType: hard - "portfinder@npm:^1.0.23": version: 1.0.32 resolution: "portfinder@npm:1.0.32" @@ -20970,15 +20932,6 @@ __metadata: languageName: node linkType: hard -"run-node@npm:^1.0.0": - version: 1.0.0 - resolution: "run-node@npm:1.0.0" - bin: - run-node: run-node - checksum: 99a0846de16d64c81e7cce487b8d7a77907d7ff69e229ad154cc7ee33ded6f82f71309f47de33cc4c206de6c7b7c37f641d7b6488bb85cc0bfe4da6d8b029242 - languageName: node - linkType: hard - "run-parallel@npm:^1.1.9": version: 1.2.0 resolution: "run-parallel@npm:1.2.0" @@ -21109,13 +21062,6 @@ __metadata: languageName: node linkType: hard -"semver-compare@npm:^1.0.0": - version: 1.0.0 - resolution: "semver-compare@npm:1.0.0" - checksum: 75f9c7a7786d1756f64b1429017746721e07bd7691bdad6368f7643885d3a98a27586777e9699456564f4844b407e9f186cc1d588a3f9c0be71310e517e942c3 - languageName: node - linkType: hard - "semver-diff@npm:^3.1.1": version: 3.1.1 resolution: "semver-diff@npm:3.1.1"