diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml index 5960c7187..17a3119f7 100644 --- a/.github/workflows/publish-cli.yml +++ b/.github/workflows/publish-cli.yml @@ -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 @@ -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 }} diff --git a/binaries/binaries.go b/binaries/binaries.go index 7da50d3f0..4d61b6674 100644 --- a/binaries/binaries.go +++ b/binaries/binaries.go @@ -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" diff --git a/binaries/publish.sh b/binaries/publish.sh index b50073216..d632ea069 100644 --- a/binaries/publish.sh +++ b/binaries/publish.sh @@ -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 @@ -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 'peter-evans@users.noreply.github.com' + + 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