ci: Fix one place where we commit to main (#1770) #7950
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: 1/2b. Bump versions for extension only (on push to main and patch branch) | |
# This workflow covers both '1_check_for_updates' and '2_bump_versions' workflows, therefore it is another variant of the same, but specifically for extension only, without any Prisma CLI updates that would need to be handled. | |
on: | |
push: | |
branches: | |
- 'main' | |
- '**.x' | |
- '!renovate/**' | |
paths-ignore: | |
- '.github/**' | |
workflow_dispatch: | |
env: | |
ENVIRONMENT: ${{ secrets.ENVIRONMENT }} | |
PRISMA_TELEMETRY_INFORMATION: 'language-tools 1_2_b_bump_extension_only.yml' | |
jobs: | |
bump: | |
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 && npm run bootstrap | |
shell: bash | |
- name: checkout main if necessary | |
if: endsWith(github.ref, '/main') == false | |
run: git fetch && git checkout main | |
- name: Setup Git | |
run: | | |
sh scripts/set_git_credentials.sh | |
- name: Update extension version in scripts folder | |
id: update | |
run: node scripts/bump_extension_version.js dev | |
- name: Commit and Push | |
run: | | |
sh scripts/commit_and_push.sh "[skip ci] bump extension version in scripts to ${{ steps.update.outputs.next_extension_version }}." | |
- name: Checkout previous branch | |
if: endsWith(github.ref, '/main') == false | |
run: git checkout ${{ github.ref_name }} | |
- name: Update VS Code extension version | |
run: | | |
node scripts/update_package_json_files.js dev ${{ steps.update.outputs.next_extension_version }} "" | |
- name: Install Dependencies | |
run: npm install && npm run bootstrap | |
- name: Commit and Push | |
run: | | |
sh scripts/commit_and_push.sh "[skip ci] bump extension version in package.json to ${{ steps.update.outputs.next_extension_version }}." ${{ steps.setup_branch.outputs.new_branch }} | |
- name: Trigger next workflow for Language Server tests | |
if: endsWith(github.ref, '/main') | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: 3. Test Language Server and publish | |
token: ${{ secrets.PRISMA_BOT_TOKEN }} | |
inputs: '{ "npm_channel": "dev", "extension_version": "${{ steps.update.outputs.next_extension_version }}", "branch": "main", "trigger_reason": "Commit from ${{ github.ref_name }}" }' | |
- name: Trigger next workflow for Language Server tests | |
if: endsWith(github.ref, '/main') == false | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: 3. Test Language Server and publish | |
token: ${{ secrets.PRISMA_BOT_TOKEN }} | |
inputs: '{ "npm_channel": "patch-dev", "extension_version": "${{ steps.update.outputs.next_extension_version }}", "branch": "${{ github.ref_name }}", "trigger_reason": "Commit from ${{ github.ref_name }}" }' | |
- 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/2b. - Bumping versions for 'extension only' failed :x:" | |
SLACK_COLOR: '#FF0000' | |
SLACK_MESSAGE: '${{ steps.update.outputs.next_extension_version }} - On push to ${{ github.ref_name }}.' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_FAILURES }} | |
SLACK_CHANNEL: feed-language-tools-failures | |
SLACK_USERNAME: Prismo | |
SLACK_ICON_EMOJI: ':boom:' | |
SLACK_MSG_AUTHOR: prisma-bot |