Skip to content

Commit

Permalink
ci(publish-cli): create PR on new version
Browse files Browse the repository at this point in the history
  • Loading branch information
steebchen committed Oct 11, 2023
1 parent e7ac9ef commit a88e0b6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ jobs:
publish:
name: Publish Prisma CLI
runs-on: macos-13-xlarge
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
Expand All @@ -20,3 +23,8 @@ jobs:
AWS_DEFAULT_REGION: eu-west-1
AWS_ACCESS_KEY_ID: ${{ secrets.PRISMA_CLI_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PRISMA_CLI_AWS_SECRET_ACCESS_KEY }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: 'chore(prisma): upgrade Prisma CLI'
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions binaries/binaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
)

// PrismaVersion is a hardcoded version of the Prisma CLI.
const PrismaVersion = "5.4.1"
const PrismaVersion = ""

// EngineVersion is a hardcoded version of the Prisma Engine.
// The versions can be found under https://github.com/prisma/prisma-engines/commits/main
const EngineVersion = "2f302df92bd8945e20ad4595a73def5b96afa54f"
const EngineVersion = "a5596b96668f0f4b397761ce0956db54e17e48c4"

// PrismaURL points to an S3 bucket URL where the CLI binaries are stored.
var PrismaURL = "https://packaged-cli.prisma.sh/%s-%s-%s-%s.gz"
Expand Down
16 changes: 16 additions & 0 deletions binaries/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ cp -R node_modules/@prisma/engines/* node_modules/prisma/node_modules/@prisma/en

npx pkg -t node18-linuxstatic-x64,node18-darwin-x64,node18-win-x64,node18-linuxstatic-arm64,node18-darwin-arm64,node18-win-arm64 node_modules/prisma

export PRISMA_HIDE_UPDATE_MESSAGE=true

version=$(npx prisma version | grep '^\(prisma \)' | cut -d : -f 2 | cut -d " " -f 2)
hash=$(npx prisma version | grep '^\(Default Engines Hash\)' | cut -d : -f 2 | cut -d " " -f 2)

# abort if the installed version does not equal the release version
if [ "$version" != "$v" ]; then
Expand Down Expand Up @@ -82,4 +85,17 @@ aws s3 cp "$processed_name" "s3://$S3_BUCKET" --acl public-read
cd ..
rm -r out/

cd ..

echo "Successfully published Prisma CLI $version"

if [[ $CI == 'true' ]]; then
echo "Committing changes"
git config user.name 'GitHub Actions'
git config user.email '[email protected]'

sed -i '' -e "s/const EngineVersion = \".*\"/const EngineVersion = \"$hash\"/g" binaries.go
sed -i '' -e "s/const PrismaVersion = \".*\"/const PrismaVersion = \"$version\"/g" binaries.go

# changes are picked up by GitHub actions
fi

0 comments on commit a88e0b6

Please sign in to comment.