91 lines (79 loc) · 3.86 KB
/
update-studio-version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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 Studio to ${{ github.event.inputs.version }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.2
with:
version: 6
- uses: actions/setup-node@v3
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 is available on npm
run: |
echo 'Checking that all packages [@prisma/studio, @prisma/studio-server] have the published version @${{ github.event.inputs.version }}'
pnpx -y -p @prisma/ensure-npm-release enr update -p @prisma/studio -u ${{ 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, @prisma/studio-server to ${{ github.event.inputs.version }} using pnpm'
pnpm update -r @prisma/studio@${{ github.event.inputs.version }} @prisma/studio-server@${{ github.event.inputs.version }}
echo 'Awesome - proceeding to make the PR'
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
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`| https://npmjs.com/package/@prisma/studio/v/${{ github.event.inputs.version }}|
|`@prisma/studio-server`| https://npmjs.com/package/@prisma/studio-server/v/${{ github.event.inputs.version }}|
## Studio repository for tag provided
[`${{ github.event.inputs.version }}`](https://github.com/prisma/studio-code/tree/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 }}
- 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.0
env:
SLACK_TITLE: 'Update Studio 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