editor.js/.github/workflows/publish-package-to-npm.yml
Gusev Yaroslav af6b64a3e6
Added a github link to codex bot release notification (#2527)
* Added a github link to codex bot release notification

* Url now depends on type of release

* Removed unnecessary condition

* fixed indentation
2023-11-06 19:00:19 +03:00

65 lines
1.9 KiB
YAML

name: Publish package to NPM
on:
release:
types:
- published
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Checkout to target branch
- uses: actions/checkout@v4
with:
# Pull submodules
submodules: 'recursive'
- name: Get package info
id: package
uses: codex-team/action-nodejs-package-info@v1
# Setup node environment
- uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/
# Prepare, build and publish project
- name: Install dependencies
run: yarn
- name: Build output files
run: yarn build
- name: Publish the package with a NEXT tag
run: yarn publish --access=public --tag=next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Add LATEST tag for the published package if this is not a prerelease version
if: github.event.release.prerelease != true
run: npm dist-tag add ${{ steps.package.outputs.name }}@${{ steps.package.outputs.version }} latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
notify:
needs: publish
runs-on: ubuntu-latest
env:
GITHUB_LINK: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}
steps:
# Checkout to target branch
- uses: actions/checkout@v4
- name: Get package info
id: package
uses: codex-team/action-nodejs-package-info@v1
- name: Send a message
uses: codex-team/action-codexbot-notify@v1
with:
webhook: ${{ secrets.CODEX_BOT_NOTIFY_EDITORJS_PUBLIC_CHAT }}
message: '📦 [${{ steps.package.outputs.name }} ${{ steps.package.outputs.version }}](${{ env.GITHUB_LINK }}) was published'
parse_mode: 'markdown'
disable_web_page_preview: true