Skip to content

feat(package): bumps version #24

feat(package): bumps version

feat(package): bumps version #24

Workflow file for this run

name: Publish package to NPM registry
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
check_version:
name: Check version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install jq
run: |
sudo apt update -y
sudo apt install -y jq
- name: Check npm version corresponds to tag
shell: bash
run: |
tag_version=$(echo $GITHUB_REF_NAME | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+(-.+)?")
npm_version=$(jq -r '.version' ./package.json)
[ "$tag_version" = "$npm_version" ]
lint:
needs:
- check_version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: lint
run: |
npm ci
npm run format
git diff | tee .ci-temp
exit $(test -f .ci-temp && cat .ci-temp | wc -l)
linux-build:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
shell: bash
run: |
sudo apt update
sudo apt install libpulse-dev -yq
- name: Build Linux Binary
working-directory: ${{github.workspace}}
shell: bash
run: |
npm ci
npm run build:bin
- name: Save Binary
uses: actions/upload-artifact@v3
with:
name: linux-binary
path: ./dist/addons/linux-sound-mixer.node
win-build:
needs: lint
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Windows API build
working-directory: ${{github.workspace}}
shell: bash
run: |
npm ci
npm run build:bin
- name: Save Binary
uses: actions/upload-artifact@v3
with:
name: windows-binary
path: ./dist/addons/win-sound-mixer.node
publish:
needs: [win-build, linux-build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: TS build
run: |
npm ci
npm run build:ts
- name: Create addons folder
shell: bash
run: mkdir -p ./dist/addons
- name: Download windows addon
uses: actions/download-artifact@v3
with:
name: windows-binary
path: ./dist/addons/
- name: Download linux addon
uses: actions/download-artifact@v3
with:
name: linux-binary
path: ./dist/addons/
- name: Check artifacts are present
working-directory: ./dist/addons/
run: test -f linux-sound-mixer.node && test -f win-sound-mixer.node
- name: Publish package to npm registry
id: publish_package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create compressed folder release
run: |
tar -cvf ./release.tar.gz ./dist/ ./package.json
- name: Create github release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: "release.tar.gz"