3. Test Language Server and publish - Commit from main #5802
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 3. Test Language Server and publish | |
run-name: 3. Test Language Server and publish - ${{ inputs.trigger_reason }} | |
on: | |
workflow_dispatch: | |
inputs: | |
npm_channel: | |
description: 'Prisma CLI NPM Channel' | |
required: true | |
extension_version: | |
description: 'VS Code extension version' | |
required: true | |
branch: | |
description: 'Branch to run run this workflow on' | |
required: true | |
trigger_reason: | |
description: 'Information about what caused the publishing process in the first place.' | |
required: true | |
env: | |
PRISMA_TELEMETRY_INFORMATION: 'language-tools 3_LS_unit_tests_publish.yml' | |
jobs: | |
tests: | |
name: Run tests | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
token: ${{ secrets.PRISMA_BOT_TOKEN }} | |
ref: ${{ github.event.inputs.branch }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Install Dependencies | |
run: npm install && npm run bootstrap | |
- name: Build Language Server | |
run: npx lerna run build --scope @prisma/language-server | |
- name: Run Language Server tests | |
run: npx lerna run test --scope @prisma/language-server | |
bump: | |
name: Bump Language Server version | |
needs: [tests] | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
# Setup .npmrc file to publish to npm | |
registry-url: 'https://registry.npmjs.org' | |
- name: Print inputs | |
run: | | |
echo ${{github.event.inputs.npm_channel}} | |
echo ${{github.event.inputs.extension_version}} | |
echo ${{github.event.inputs.branch}} | |
echo ${{github.event.inputs.trigger_reason}} | |
- name: Install Dependencies | |
run: npm install && npm run bootstrap | |
- name: Build Language Server | |
run: npx lerna run build --scope @prisma/language-server | |
- name: Publish Language Server to npm | |
run: npx lerna exec --scope @prisma/language-server -- npm publish --tag ${{ github.event.inputs.npm_channel }} --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Trigger next workflow for bumping Language Server in extension | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: 4. Bump LS in VSCode extension | |
token: ${{ secrets.GH_TOKEN }} | |
inputs: '{ "npm_channel": "${{ github.event.inputs.npm_channel }}", "extension_version": "${{ github.event.inputs.extension_version }}", "branch": "${{ github.event.inputs.branch }}", "trigger_reason": "${{github.event.inputs.trigger_reason}}" }' | |
slack: | |
name: Send slack notification | |
runs-on: ubuntu-latest | |
timeout-minutes: 7 | |
needs: [tests, bump] | |
if: always() | |
env: | |
SLACK_MESSAGE: '${{ needs.build.outputs.tag_name }} - ${{github.event.inputs.trigger_reason}} ' | |
steps: | |
- name: 'Set current job url in SLACK_FOOTER env var' | |
if: ${{ always() }} | |
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() || needs.tests.result == 'failure' || needs.bump.result == 'failure' }} | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_TITLE: '3. Test Language Server and publish failed :x:' | |
SLACK_COLOR: '#FF0000' | |
SLACK_MESSAGE: '${{github.event.inputs.extension_version}} - ${{github.event.inputs.trigger_reason}} ' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_FAILURES }} | |
SLACK_CHANNEL: feed-language-tools-failures | |
SLACK_USERNAME: Prismo | |
SLACK_ICON_EMOJI: ':boom:' | |
SLACK_MSG_AUTHOR: prisma-bot |