Bump version to 0.5.1 #21
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: CI/CD | |
on: | |
push: | |
branches: [ main, develop ] | |
tags: | |
- 'v*' | |
pull_request: | |
branches: [ main, develop ] | |
jobs: | |
build-test-publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@bcopy' | |
- name: Install dependencies | |
run: npm ci | |
- name: Run unit tests | |
run: npm test | |
- name: Start Mosquitto | |
uses: namoshek/mosquitto-github-action@v1 | |
with: | |
version: '1.6' | |
ports: '1883:1883' | |
container-name: 'mqtt' | |
- name: Run integration tests | |
run: npm run test:integration | |
env: | |
MQTT_BROKER_URL: mqtt://localhost:1883 | |
- name: Build | |
run: npm run build | |
- name: Publish to GitHub Packages | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
# Remove the existing "stable" tag if it exists | |
if npm dist-tag ls | grep -q "stable"; then | |
npm dist-tag rm $npm_package_name stable | |
fi | |
# Publish the package with the "stable" tag | |
npm version --no-git-tag-version stable | |
npm publish --tag stable | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
create-release: | |
needs: build-test-publish | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false |