Updated version and changelog #202
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: Dev publish | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: | | |
npm ci | |
npm run build | |
npm run test | |
publish-npm: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org/ | |
always-auth: true | |
- name: Extract PACKAGE_VERSION | |
id: package-version | |
uses: martinbeentjes/npm-get-version-action@master | |
- name: Prepare Discord notification messages | |
id: discord-prepare | |
run: | | |
echo ::set-output name=DISCORD_MSG_DEV_ANN::'{"title":"New dev version `${{ steps.package-version.outputs.current-version }}` has been released.","description":"Changelog is available [here](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/commits/dev/CHANGELOG.md)","url":"https://github.com/NRCHKB/node-red-contrib-homekit-bridged/tree/dev","color":9371648,"fields":[{"name":"How to install","value":"1. Stop node-red\n2. Backup `~/.node-red` folder\n3. `cd ~/.node-red`\n4. `npm i node-red-contrib-homekit-bridged@${{ steps.package-version.outputs.current-version }}`\n5. Start node-red"}]}' | |
echo ::set-output name=DISCORD_MSG_ERROR::'{"title":"Dev version `${{ steps.package-version.outputs.current-version }}` failed to be released.","description":"Changelog is available [here](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/commits/dev/CHANGELOG.md)","url":"https://github.com/NRCHKB/node-red-contrib-homekit-bridged/tree/dev","color":9371648,"fields":[{"name":"How to install","value":"1. Stop node-red\n2. Backup `~/.node-red` folder\n3. `cd ~/.node-red`\n4. `npm i node-red-contrib-homekit-bridged@${{ steps.package-version.outputs.current-version }}`\n5. Start node-red"}]}' | |
- name: Publish | |
if: contains(steps.package-version.outputs.current-version, 'dev') == true | |
run: | | |
npm ci | |
npm run build | |
npm publish --tag dev | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NODE_TKN}} | |
- name: Discord notification | |
if: contains(steps.package-version.outputs.current-version, 'dev') == true | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_DEV_ANN }} | |
DISCORD_EMBEDS: ${{ steps.discord-prepare.outputs.DISCORD_MSG_DEV_ANN }} | |
uses: Shaquu/action-discord@master | |
- name: Discord error notification | |
if: ${{ failure() }} | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_ERROR }} | |
DISCORD_EMBEDS: ${{ steps.discord-prepare.outputs.DISCORD_MSG_ERROR }} | |
uses: Shaquu/action-discord@master |