Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: create action for studio updates #8502

Merged
merged 2 commits into from
Jul 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/update-studio-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

name: update-studio-version
on:
workflow_dispatch:
inputs:
version:
description: "Version to check and update the studio version"
required: true

jobs:
update_studio:
name: "Check and update @prisma/studio-server@${{ github.event.inputs.version }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v2

- uses: pnpm/action-setup@v2.0.1
with:
version: 6.9.1

# This step uses `@prisma/ensure-npm-release` (abbv. `enr`) https://github.com/prisma/ensure-npm-release
- name: Check if version is available on npm
run: |
echo 'Checking that package @prisma/studio-server have the published version @${{ github.event.inputs.version }}'
pnpx -y -p @prisma/ensure-npm-release enr update -p @prisma/studio-server -u ${{ github.event.inputs.version }}
echo 'Awesome - proceeding to make the PR'

- name: Update the studio dependencies
run: |
echo 'Updating @prisma/studio-server to ${{ github.event.inputs.version }} using pnpm'
cd src
pnpm update -r @prisma/studio-server@${{ github.event.inputs.version }}

- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.BOT_TOKEN }}
commit-message: "chore(deps): update studio to ${{ github.event.inputs.version }}"
committer: "Prismo <prismabots@gmail.com>"
author: "Prismo <prismabots@gmail.com>"
branch: deps/studio${{ github.event.inputs.version }}
delete-branch: true
labels: automerge
title: "chore(deps): update studio to ${{ github.event.inputs.version }}"
body: |
This automatic PR updates the studio to version `${{ github.event.inputs.version }}`. This will get automatically merged if all the tests pass.
## Packages:
| Package | NPM URL |
|---------|---------|
|`@prisma/studio-server`| https://npmjs.com/package/@prisma/studio-server/v/${{ github.event.inputs.version }}|

- name: PR url
run: |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

- name: Sleep for 5 seconds
run: sleep 5s
shell: bash

- name: Auto approve Pull Request (to trigger automerge if tests passing)
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.cpr.outputs.pull-request-number }}