diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 14a2dc1..169824a 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -6,7 +6,24 @@ on: - '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) + exit [ "$tag_version" = "$npm_version" ] lint: + needs: + - check_version runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -69,6 +86,8 @@ jobs: publish: needs: [win-build, linux-build] runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -96,6 +115,16 @@ jobs: 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" diff --git a/package.json b/package.json index 4e9131b..0f82c65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "native-sound-mixer", - "version": "3.4.1-win", + "version": "3.4.2-win", "description": "node js native sound mixer module", "main": "dist/sound-mixer.js", "scripts": {