7. Publish - Commit from main #4183
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: 7. Publish | |
run-name: 7. Publish - ${{ inputs.trigger_reason }} | |
on: | |
workflow_dispatch: | |
inputs: | |
asset_name: | |
description: 'Name of the .vsix file in the release' | |
required: true | |
tag_name: | |
description: 'The release version/tag to fetch from.' | |
required: true | |
trigger_reason: | |
description: 'Information about what caused the publishing process in the first place.' | |
required: true | |
env: | |
ENVIRONMENT: ${{ secrets.ENVIRONMENT }} | |
PRISMA_TELEMETRY_INFORMATION: 'language-tools 7_publish.yml' | |
SLACK_USERNAME: Prismo | |
SLACK_ICON_EMOJI: ':ship:' | |
SLACK_MSG_AUTHOR: prisma-bot | |
jobs: | |
marketplace: | |
name: Publish to marketplace | |
runs-on: ubuntu-latest | |
timeout-minutes: 7 | |
env: | |
SLACK_MESSAGE: '${{ github.event.inputs.tag_name }} - ${{github.event.inputs.trigger_reason}}' | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Print inputs | |
run: | | |
echo ${{github.event.inputs.asset_name}} | |
echo ${{github.event.inputs.tag_name}} | |
echo ${{github.event.inputs.trigger_reason}} | |
- name: Install Dependencies | |
run: npm install && npm run bootstrap | |
# Download Asset from GH release and publish to VS Code marketplace | |
- uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: 'prisma/language-tools' | |
version: 'tags/${{ github.event.inputs.tag_name }}' | |
file: ${{ github.event.inputs.asset_name }} | |
token: ${{ secrets.GH_TOKEN }} | |
- name: publish vsix to marketplace | |
run: cd packages/vscode && npx vsce publish --pat ${{ secrets.AZURE_DEVOPS_PERSONAL_ACCESS_TOKEN}} --packagePath ${{github.workspace}}/${{ github.event.inputs.asset_name }} | |
- 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() }} | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_TITLE: '7. Publishing to marketplace failed :x:' | |
SLACK_COLOR: '#FF0000' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_FAILURES }} | |
SLACK_CHANNEL: feed-language-tools-failures | |
- name: Slack Notification on Success | |
if: ${{ success() }} | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_TITLE: '7. Published to marketplace :white_check_mark:' | |
SLACK_COLOR: '#008000' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_CHANNEL: feed-language-tools | |
open-vsx: | |
name: Publish to open-vsx | |
runs-on: ubuntu-latest | |
timeout-minutes: 7 | |
env: | |
SLACK_MESSAGE: '${{ github.event.inputs.tag_name }} - ${{github.event.inputs.trigger_reason}}' | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Print inputs | |
run: | | |
echo ${{github.event.inputs.trigger_reason}} | |
- name: Install Dependencies | |
run: npm install && npm run bootstrap | |
# Download Asset from GH release and publish to open-vsx | |
- uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: 'prisma/language-tools' | |
version: 'tags/${{ github.event.inputs.tag_name }}' | |
file: ${{ github.event.inputs.asset_name }} | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Publish vsix to open-vsx.org | |
run: cd packages/vscode && npx ovsx publish ${{github.workspace}}/${{ github.event.inputs.asset_name }} --pat ${{ secrets.OPEN_VSX_ACCESS_TOKEN }} | |
- 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() }} | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_TITLE: '7. Publishing to open-vsx failed :x:' | |
SLACK_COLOR: '#FF0000' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_FAILURES }} | |
SLACK_CHANNEL: feed-language-tools-failures | |
- name: Slack Notification on Success | |
if: ${{ success() }} | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_TITLE: '7. Published to open-vsx :white_check_mark:' | |
SLACK_COLOR: '#008000' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_CHANNEL: feed-language-tools |