4.3.0 #40
Workflow file for this run
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: NPM Publish | |
# Only publish on a new release being cut | |
on: | |
release: | |
types: [created] | |
jobs: | |
notify_init: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Add SHORT_SHA env property with commit short sha | |
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV | |
- name: Discord notification PR | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: > | |
<:js:889588003851358208> [[{{ SHORT_SHA }}](https://github.com/{{ GITHUB_REPOSITORY }}/commit/{{ SHORT_SHA }})] [Starting Kolibri JS release publish...](https://github.com/{{ GITHUB_REPOSITORY }}/actions/runs/{{ GITHUB_RUN_ID }}?check_suite_focus=true) | |
```${{ github.event.head_commit.message }}``` | |
build_and_publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
scope: '@hover-labs' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Retrieve the cached "node_modules" directory (if present) | |
uses: actions/cache@v3 | |
id: node-cache | |
with: | |
path: node_modules | |
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies (if the cached directory was not found) | |
if: steps.node-cache.outputs.cache-hit != 'true' | |
run: npm ci --legacy-peer-deps | |
- run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
notify_complete: | |
runs-on: ubuntu-latest | |
needs: | |
- notify_init | |
- build_and_publish | |
steps: | |
- name: Add SHORT_SHA env property with commit short sha | |
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV | |
- name: Discord notification PR | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: > | |
<:js:889588003851358208> [[{{ SHORT_SHA }}](https://github.com/{{ GITHUB_REPOSITORY }}/commit/{{ SHORT_SHA }})] [Kolibri JS published successfully!](https://github.com/{{ GITHUB_REPOSITORY }}/actions/runs/{{ GITHUB_RUN_ID }}?check_suite_focus=true) | |
```${{ github.event.head_commit.message }}``` | |