Skip to content

Update Engines on npm latest 5.8.0-16.dc5bde32ed8434159f53f3985c872265df62672f #1885

Update Engines on npm latest 5.8.0-16.dc5bde32ed8434159f53f3985c872265df62672f

Update Engines on npm latest 5.8.0-16.dc5bde32ed8434159f53f3985c872265df62672f #1885

name: Update Engines Version
run-name: Update Engines on npm ${{ inputs.npmDistTag }} ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: 'Version to check and update the engines version'
required: true
npmDistTag:
description: 'npm tag used for `@prisma/engines-version` in prisma/engines-wrapper repo (`latest` or `integration` or `patch`)'
required: true
type: choice
options:
- latest
- integration
- patch
jobs:
update_engines:
name: 'Check and update @prisma/engines-version@${{ github.event.inputs.version }}'
runs-on: ubuntu-latest
steps:
- name: Print workflow_dispatch input
env:
THE_INPUT: '${{ toJson(github.event.inputs) }}'
run: |
echo $THE_INPUT
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2.4.0
with:
version: 8
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version: '16'
# This step uses `@prisma/ensure-npm-release` (abbv. `enr`) https://github.com/prisma/ensure-npm-release
- name: Check if version of @prisma/engines-version is available on npm
run: |
echo 'Checking that @prisma/engines-version have the published version @${{ github.event.inputs.version }}'
pnpm --package=@prisma/ensure-npm-release dlx enr update -p @prisma/engines-version -u ${{ github.event.inputs.version }}
# Note: @prisma/prisma-schema-wasm might take a few minutes before it's available
# So expect to see a few automated retries happening in logs before it succeeds
- name: Check if version of @prisma/prisma-schema-wasm is available on npm
run: |
echo 'Checking that @prisma/prisma-schema-wasm have the published version @${{ github.event.inputs.version }}'
pnpm --package=@prisma/ensure-npm-release dlx enr update -p @prisma/prisma-schema-wasm -u ${{ github.event.inputs.version }}
# Note: @prisma/query-engine-wasm might take a few minutes before it's available too
- name: Check if version of @prisma/query-engine-wasm is available on npm
run: |
echo 'Checking that @prisma/query-engine-wasm have the published version @${{ github.event.inputs.version }}'
pnpm --package=@prisma/ensure-npm-release dlx enr update -p @prisma/query-engine-wasm -u ${{ github.event.inputs.version }}
- name: Update the dependencies (@prisma/engines-version)
uses: nick-fields/retry@v2
with:
timeout_minutes: 7
max_attempts: 3
command: |
echo 'Updating @prisma/engines-version to ${{ github.event.inputs.version }} using pnpm'
pnpm update -r @prisma/engines-version@${{ github.event.inputs.version }}
- name: Update the dependencies (@prisma/prisma-schema-wasm)
uses: nick-fields/retry@v2
with:
timeout_minutes: 7
max_attempts: 3
command: |
echo 'Updating @prisma/prisma-schema-wasm to ${{ github.event.inputs.version }} using pnpm'
pnpm update -r @prisma/prisma-schema-wasm@${{ github.event.inputs.version }}
- name: Update the dependencies (@prisma/query-engine-wasm)
uses: nick-fields/retry@v2
with:
timeout_minutes: 7
max_attempts: 3
command: |
echo 'Updating @prisma/query-engine-wasm to ${{ github.event.inputs.version }} using pnpm'
pnpm update -r @prisma/query-engine-wasm@${{ github.event.inputs.version }}
- name: Extract Engine Commit hash from version
id: extract-engine-commit-hash
uses: actions/github-script@v7
with:
script: |
const hash = context.payload.inputs.version.split('.').pop()
core.setOutput('hash', hash)
#
# Regular engines PR, from prisma-engines main branch
# Will be automerged if tests are passing
#
- name: Create Pull Request
id: cpr
if: github.event.inputs.npmDistTag == 'latest'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.BOT_TOKEN }}
commit-message: 'chore(deps): update engines to ${{ github.event.inputs.version }}'
committer: 'Prismo <prismabots@gmail.com>'
author: 'Prismo <prismabots@gmail.com>'
branch: deps/engines-${{ github.event.inputs.version }}
delete-branch: true
labels: automerge
title: 'chore(deps): update engines to ${{ github.event.inputs.version }}'
body: |
The base branch for this PR is: main
This automatic PR updates the engines to version `${{ github.event.inputs.version }}`.
This will get automatically merged if all the tests pass.
:warning: If this PR needs to be updated, first remove the `automerge` label before pushing to avoid automerge to merge without waiting for tests.
## Packages
| Package | NPM URL |
|---------|---------|
|`@prisma/engines-version`| https://npmjs.com/package/@prisma/engines-version/v/${{ github.event.inputs.version }}|
|`@prisma/prisma-schema-wasm`| https://npmjs.com/package/@prisma/prisma-schema-wasm/v/${{ github.event.inputs.version }}|
|`@prisma/query-engine-wasm`| https://npmjs.com/package/@prisma/query-engine-wasm/v/${{ github.event.inputs.version }}|
## Engines commit
[`prisma/prisma-engines@${{ steps.extract-engine-commit-hash.outputs.hash }}`](https://github.com/prisma/prisma-engines/commit/${{ steps.extract-engine-commit-hash.outputs.hash }})
- name: PR url
if: github.event.inputs.npmDistTag == 'latest'
run: |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Sleep for 5 seconds
if: github.event.inputs.npmDistTag == 'latest'
run: sleep 5s
shell: bash
- name: Auto approve Pull Request (to trigger automerge if tests passing)
if: github.event.inputs.npmDistTag == 'latest' && steps.cpr.outputs.pull-request-operation == 'created'
uses: juliangruber/approve-pull-request-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.cpr.outputs.pull-request-number }}
#
# Integration Engine PR for end to end testing (From prisma/prisma-engines to prisma/prisma and finally npm)
# This will create a draft PR as we don't want to merge it
# But we want to publish it to npm
# For that we can create an `integration/` branch
#
- name: Create Pull Request for Integration Engine
id: cpr-integration
if: github.event.inputs.npmDistTag == 'integration'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.BOT_TOKEN }}
commit-message: 'chore(deps): update engines to ${{ github.event.inputs.version }}'
committer: 'Prismo <prismabots@gmail.com>'
author: 'Prismo <prismabots@gmail.com>'
branch: integration/engines-${{ github.event.inputs.version }}
delete-branch: true
draft: true
title: 'chore(Automated Integration PR): update engines to ${{ github.event.inputs.version }}'
body: |
The base branch for this PR is: main
This automatic integration PR updates the engines to version `${{ github.event.inputs.version }}`.
:warning: This PR should normally not be merged.
## Packages
| Package | NPM URL |
|---------|---------|
|`@prisma/engines-version`| https://npmjs.com/package/@prisma/engines-version/v/${{ github.event.inputs.version }}|
|`@prisma/prisma-schema-wasm`| https://npmjs.com/package/@prisma/prisma-schema-wasm/v/${{ github.event.inputs.version }}|
|`@prisma/query-engine-wasm`| https://npmjs.com/package/@prisma/query-engine-wasm/v/${{ github.event.inputs.version }}|
## Engines commit
[`prisma/prisma-engines@${{ steps.extract-engine-commit-hash.outputs.hash }}`](https://github.com/prisma/prisma-engines/commit/${{ steps.extract-engine-commit-hash.outputs.hash }})
- name: PR url
if: github.event.inputs.npmDistTag == 'integration'
run: |
echo "Pull Request URL - ${{ steps.cpr-integration.outputs.pull-request-url }}"
#
# Patch Engine PR, from a prisma-engines patch branch (e.g. "4.6.x")
# This will create a PR that will need to be manually merged
#
- name: Extract patch branch name from version
id: extract-patch-branch-name
uses: actions/github-script@v7
with:
script: |
const parts = context.payload.inputs.version.split('.')
const patchBranch = `${parts[0]}.${parts[1]}.x`
console.log(`patchBranch: ${patchBranch}`)
core.setOutput('patchBranch', patchBranch)
- name: Create Pull Request for Patch Engine
id: cpr-patch
if: github.event.inputs.npmDistTag == 'patch'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.BOT_TOKEN }}
commit-message: 'chore(deps): update engines to ${{ github.event.inputs.version }}'
committer: 'Prismo <prismabots@gmail.com>'
author: 'Prismo <prismabots@gmail.com>'
base: ${{ steps.extract-patch-branch-name.outputs.patchBranch }}
branch: patch/${{ github.event.inputs.version }}
title: 'chore(deps): patch ${{ steps.extract-patch-branch-name.outputs.patchBranch }} ${{ github.event.inputs.version }}'
body: |
The base branch for this PR is: ${{ steps.extract-patch-branch-name.outputs.patchBranch }}
This automatic PR updates the engines to version `${{ github.event.inputs.version }}`.
This PR will need to be manually merged (no auto-merge).
## Packages
| Package | NPM URL |
|---------|---------|
|`@prisma/engines-version`| https://npmjs.com/package/@prisma/engines-version/v/${{ github.event.inputs.version }}|
|`@prisma/prisma-schema-wasm`| https://npmjs.com/package/@prisma/prisma-schema-wasm/v/${{ github.event.inputs.version }}|
|`@prisma/query-engine-wasm`| https://npmjs.com/package/@prisma/query-engine-wasm/v/${{ github.event.inputs.version }}|
## Engines commit
[`prisma/prisma-engines@${{ steps.extract-engine-commit-hash.outputs.hash }}`](https://github.com/prisma/prisma-engines/commit/${{ steps.extract-engine-commit-hash.outputs.hash }})
- name: PR url
if: github.event.inputs.npmDistTag == 'patch'
run: |
echo "Pull Request URL - ${{ steps.cpr-patch.outputs.pull-request-url }}"
- name: 'Set current job url in SLACK_FOOTER env var'
if: ${{ failure() }}
run: echo "SLACK_FOOTER=<$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID|Click here to go to the job logs>" >> $GITHUB_ENV
- name: Slack Notification on Failure
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2.2.1
env:
SLACK_TITLE: 'Update Engines Version failed :x:'
SLACK_COLOR: '#FF0000'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: feed-prisma-failures
SLACK_USERNAME: Prismo
SLACK_ICON_EMOJI: ':boom:'
SLACK_MSG_AUTHOR: prisma-bot