-
Notifications
You must be signed in to change notification settings - Fork 40
71 lines (64 loc) · 2.59 KB
/
1_check_for_updates.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
name: 1. Check for Prisma CLI Update
on:
schedule:
- cron: '*/5 * * * *'
workflow_dispatch:
env:
ENVIRONMENT: ${{ secrets.ENVIRONMENT }}
PRISMA_TELEMETRY_INFORMATION: 'language-tools 1_check_for_update.yml'
jobs:
check:
name: Check for Prisma CLI update
runs-on: ubuntu-latest
timeout-minutes: 7
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PRISMA_BOT_TOKEN }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install Dependencies
run: npm install
# First it runs this
- name: Check for Prisma CLI update
id: check_update
run: node scripts/check_for_update.js
# ... and depending on the output any (or none) of these 3:
- name: Invoke bump workflow with inputs for dev
if: ${{ steps.check_update.outputs.dev_version }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: 2. Bump versions
token: ${{ secrets.PRISMA_BOT_TOKEN }}
inputs: '{ "npm_channel": "dev", "version": "${{ steps.check_update.outputs.dev_version }}" }'
- name: Invoke bump workflow with inputs for latest
if: ${{ steps.check_update.outputs.latest_version }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: 2. Bump versions
token: ${{ secrets.PRISMA_BOT_TOKEN }}
inputs: '{ "npm_channel": "latest", "version": "${{ steps.check_update.outputs.latest_version }}" }'
- name: Invoke bump workflow with inputs for patch-dev
if: ${{ steps.check_update.outputs.patch-dev_version }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: 2. Bump versions
token: ${{ secrets.PRISMA_BOT_TOKEN }}
inputs: '{ "npm_channel": "patch-dev", "version": "${{ steps.check_update.outputs.patch-dev_version }}" }'
- 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/[email protected]
env:
SLACK_TITLE: '1. Checking for Prisma CLI Update failed :x:'
SLACK_COLOR: '#FF0000'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_FAILURES }}
SLACK_CHANNEL: feed-language-tools-failures
SLACK_USERNAME: Prismo
SLACK_ICON_EMOJI: ':boom:'
SLACK_MSG_AUTHOR: prisma-bot