Skip to content

Commit

Permalink
Prerelease mode BETA (#118)
Browse files Browse the repository at this point in the history
* beta mode

* add back yarn updates and group them by dev or prod dependency

---------

Co-authored-by: Aaron <[email protected]>
  • Loading branch information
aaronmgdr and aaronmgdr authored Oct 30, 2023
1 parent cb6a428 commit 0dde5fb
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 93 deletions.
2 changes: 2 additions & 0 deletions .changeset/dull-feet-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
14 changes: 14 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -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": []
}
20 changes: 18 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 1 addition & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
publish: yarn release
2 changes: 2 additions & 0 deletions .github/workflows/social-connect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ on:
push:
branches:
- main
- changeset-release/prerelease/*
pull_request:
branches:
- main
- prerelease/*

concurrency:
group: social-connect-${{ github.ref }}
Expand Down
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
. "$(dirname -- "$0")/_/husky.sh"

yarn pretty-quick --staged --pattern '**/*.+(ts|js)'

bash scripts/prereleasecheck.sh
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
. "$(dirname -- "$0")/_/husky.sh"

bash scripts/prereleasecheck.sh
26 changes: 8 additions & 18 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

<https://github.com/changesets/changesets/blob/main/docs/snapshot-releases.md>
4. Now you can Open a Pr with your prerelease/? branch against main.

## Package Versioning

Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/*",
Expand All @@ -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",
Expand Down
31 changes: 31 additions & 0 deletions scripts/beta-mode.sh
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions scripts/prereleasecheck.sh
Original file line number Diff line number Diff line change
@@ -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
68 changes: 7 additions & 61 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 0dde5fb

Please sign in to comment.