-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dev): via a new Prisma Dev extension (#109)
* feat(alpha): via a new extension - Fixes #47 - Fixes #93 This PR is made against "alpha" and merging this should release a "new" alpha extension. * feat(alpha): incorporate release feedback - Remove the alpha branch dependency - Push only when bumping alpha - Bump @prisma/* packages when updating package.json * feat(alpha): use vsce show for extension version * Update scripts/bump-sha.sh Co-Authored-By: Jan Piotrowski <[email protected]> * feat(dev): publish Prisma Dev as a new extension - rename to dev - merge with master, adjust bump deps - add release-workflow.md * Update release-workflow.md Co-Authored-By: Jan Piotrowski <[email protected]> * fix: job name Fixes #82 Co-authored-by: Jan Piotrowski <[email protected]>
- Loading branch information
Showing
9 changed files
with
158 additions
and
29 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Release Workflow | ||
|
||
## Trigger | ||
|
||
Schedule (every 5 minutes) or push to `master` branch. | ||
|
||
## Development | ||
|
||
With `PRODUCTION=0` in environment, the script doesn't publish but outputs the commands that would be run. A publish is only triggered when `PRODUCTION=1` is set. | ||
|
||
Entry point to test development is `yarn vsce:check <channel>`, where `channel=dev|latest`. | ||
|
||
## Steps | ||
|
||
1. Defined in the file `.github/workflows/publish.yml` | ||
1. `yarn vsce:check <channel>` is run twice with "dev" and "latest" as channels respectively. Internally, it calls `check-update.sh <channel>` | ||
|
||
Note the both `dev` workflow and `latest` workflow call the same scripts, the channel variable acts as a workflow discriminator as both workflows have slight differences, now we list the workflow steps in details: | ||
|
||
### Dev workflow | ||
|
||
1. `yarn vsce:check dev` calls `check-update.sh dev` | ||
1. `check-update.sh` sets up the repo with Prismo bot as the user, all commits in the remainder of this workflow are attributed to Prismo. | ||
1. `check-update.sh` compares `CURRENT_VERSION` (extension) against `NPM_VERSION` of Prisma CLI. | ||
1. If they are same, this script exits | ||
1. If they are different, `bump.sh <channel> <version>` is called with `channel=dev` and `version=NPM_VERSION` (i.e. the new version of extension to publish) | ||
1. `bump.sh` updates the `package.json` files in root, client, server and sets `name`, `displayName`, `version`, `dependencies.@prisma/*` packages, and `prisma.version` values. | ||
1. `check-update.sh` then commits these changes, this commit is required because `vsce publish` (to be run later requires a clean git state) | ||
1. `yarn vsce:publish <channel> <version>` i.e. `publish.sh <channel> <version>` is then called with `channel=dev` and `version=NPM_VERSION` (i.e. the new version of extension to publish). This command publishes the "Prisma Dev" extension. | ||
1. `publish.sh` pushes to vscode master repo. Only changes from the dev channel are pushed. | ||
|
||
### Latest workflow | ||
|
||
1. `yarn vsce:check latest` calls `check-update.sh latest` | ||
1. `check-update.sh` sets up the repo with Prismo bot as the user, all commits in the remainder of this workflow are attributed to Prismo. | ||
1. `check-update.sh` compares `CURRENT_VERSION` (extension) against `NPM_VERSION` of Prisma CLI. | ||
1. If they are same, this script exits | ||
1. If they are different, `bump.sh <channel> <version>` is called with `channel=latest` and `version=NPM_VERSION` (i.e. the new version of extension to publish) | ||
1. `bump.sh` updates the `package.json` files in root, client, server and sets `name`, `displayName`, `version`, `dependencies.@prisma/*` packages, and `prisma.version` values. | ||
1. `check-update.sh` then commits these changes, this commit is required because `vsce publish` (to be run later requires a clean git state) | ||
1. `yarn vsce:publish <channel> <version>` i.e. `publish.sh <channel> <version>` is then called with `channel=latest` and `version=NPM_VERSION` (i.e. the new version of extension to publish). This command published the "Prisma" extension. |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
CHANNEL=$1 | ||
echo "CHANNEL: $CHANNEL" | ||
|
||
PRISMA_VERSION=$2 | ||
echo "PRISMA_VERSION: $PRISMA_VERSION" | ||
|
||
OLD_SHA=$(jq ".prisma.version" ./package.json) | ||
SHA=$(npx -q -p @prisma/cli@"$CHANNEL" prisma --version | grep "Query Engine" | awk '{print $5}') | ||
|
||
# If the channel is dev, we need to change the name, displayName to the dev extension | ||
if [ "$CHANNEL" = "dev" ]; then | ||
jq ".version = \"$PRISMA_VERSION\" | \ | ||
.name = \"prisma-dev\" | \ | ||
.displayName = \"Prisma Dev\"" \ | ||
./package.json > ./package.json.bk | ||
else | ||
jq ".version = \"$PRISMA_VERSION\" | \ | ||
.name = \"prisma\" | \ | ||
.displayName = \"Prisma\"" \ | ||
./package.json > ./package.json.bk | ||
fi | ||
|
||
jq ".version = \"$PRISMA_VERSION\" | \ | ||
.prisma.version = \"$SHA\" | \ | ||
.dependencies[\"@prisma/get-platform\"] = \"$PRISMA_VERSION\" | \ | ||
.dependencies[\"@prisma/fetch-engine\"] = \"$PRISMA_VERSION\" | \ | ||
.dependencies[\"@prisma/sdk\"] = \"$PRISMA_VERSION\"" \ | ||
./server/package.json > ./server/package.json.bk | ||
|
||
jq ".version = \"$PRISMA_VERSION\"" \ | ||
./client/package.json > ./client/package.json.bk | ||
|
||
mv ./package.json.bk ./package.json | ||
mv ./server/package.json.bk ./server/package.json | ||
mv ./client/package.json.bk ./client/package.json | ||
|
||
npm install | ||
|
||
cd ./client | ||
npm install | ||
cd .. | ||
|
||
cd ./server | ||
npm install | ||
cd .. | ||
|
||
echo "Bumped prisma.version in package.json from $OLD_SHA to $SHA" |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
CHANNEL="$1" | ||
|
||
if [ "$CHANNEL" = "dev" ]; then | ||
vsce show Prisma.prisma-dev --json | jq ".versions[0].version" | tr -d '"' | ||
else | ||
vsce show Prisma.prisma --json | jq ".versions[0].version" | tr -d '"' | ||
fi |
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 was deleted.
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