diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 97b7c89..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,169 +0,0 @@ -name: Publish -on: - push: - tags: - - "v1.*" - workflow_dispatch: - inputs: - pkgVersion: - required: true - type: string - description: Package version - releaseType: - type: choice - description: Is pre-release or next stable release - default: next - options: - - latest - - next - -jobs: - linux_build: - runs-on: ubuntu-latest - name: Build for Linux - steps: - - uses: actions/checkout@v4 - name: Checkout - - - uses: actions/setup-node@v4 - name: Setup Node.js - with: - node-version: 20.x - - - name: Install dependencies - run: | - set -ex - export DEBIAN_FRONTEND=noninteractive - sudo apt update &> /dev/null - sudo apt install -y binutils-multiarch gcc-*aarch64-linux-gnu gcc-*aarch64-linux-gnu-base g++-*aarch64-linux-gnu libc6-arm64-cross - npm install --no-save --ignore-scripts - - - name: Build addon - run: npm run prebuildify -- -v - - - name: Upload prebuilds interface - uses: actions/upload-artifact@v3 - with: - retention-days: 7 - name: prebuilds_${{ runner.os }} - path: "prebuilds/**" - - macos_build: - runs-on: macos-latest - name: Build for MacOS - steps: - - uses: actions/checkout@v4 - name: Checkout - - - uses: actions/setup-node@v4 - name: Setup Node.js - with: - node-version: 20.x - - - name: Install dependencies - run: npm install --no-save --ignore-scripts - - - name: Build addon - run: npm run prebuildify -- -v - - - name: Upload prebuilds interface - uses: actions/upload-artifact@v3 - with: - retention-days: 7 - name: prebuilds_${{ runner.os }} - path: "prebuilds/**" - - win_build: - runs-on: windows-latest - name: Build for Windows - steps: - - uses: actions/checkout@v4 - name: Checkout - - - uses: actions/setup-node@v4 - name: Setup Node.js - with: - node-version: 20.x - - - name: Install dependencies - run: npm install --no-save --ignore-scripts - - - name: Build addon - run: npm run prebuildify -- -v - - - name: Upload prebuilds interface - uses: actions/upload-artifact@v3 - with: - retention-days: 7 - name: prebuilds_${{ runner.os }} - path: "prebuilds/**" - - publish: - needs: [ linux_build, macos_build, win_build ] - runs-on: ubuntu-latest - name: Publish to npm registry - permissions: - id-token: write - pull-requests: write - issues: write - contents: write - env: - PACKAGE_VERSION: ${{ github.ref }} - steps: - - uses: actions/checkout@v4 - name: Code checkout - - - uses: actions/setup-node@v4 - name: Setup node.js - with: - node-version: 20.x - registry-url: https://registry.npmjs.org/ - - - name: Download all artefacts - uses: actions/download-artifact@v3 - with: - path: ./prebuilds - - - name: Edit version and install depencies - run: | - sudo npm i -g semver - VERSION="$(semver -c ${{ github.event_name == 'release' && github.ref_name || github.event.inputs.pkgVersion }})" - echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV - jq --arg ver $VERSION '.version = $ver' package.json > package2.json - mv -fv package2.json package.json - - # Install depencides and build - npm install --no-save --ignore-scripts - node libs/build.mjs - - - run: npm publish --access public --tag ${{ github.event_name == 'release' && (github.event.release.prerelease && 'next' || 'latest') || github.event.inputs.releaseType }} - env: - NODE_AUTH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} - - - name: Pack tgz file to release - run: npm pack - - - uses: peter-evans/create-pull-request@v5 - name: Create Pull Request - id: pull - with: - delete-branch: true - signoff: true - base: ${{ github.event_name == 'release' && github.event.release.target_commitish || github.ref_name }} - commit-message: Update to (${{ env.PACKAGE_VERSION }}) - assignees: SirHerobrine23 - reviewers: SirHerobrine23 - branch: version_update_${{ env.PACKAGE_VERSION }} - title: new release version v${{ env.PACKAGE_VERSION }} - body: Auto update version, created with GitHub Actions - add-paths: "." - - - name: Release - uses: softprops/action-gh-release@v0.1.15 - with: - prerelease: ${{ github.event_name == 'release' && github.event.release.prerelease || github.event.inputs.releaseType == 'next' }} - tag_name: ${{ github.event_name == 'release' && github.ref_name || format('v{0}', github.event.inputs.pkgVersion) }} - name: ${{ github.event_name == 'release' && github.ref_name || format('v{0}', github.event.inputs.pkgVersion) }} - body: ${{ github.event_name == 'release' && github.event.release.body || format('Release v{0}', github.event.inputs.pkgVersion) }} - target_commitish: ${{ steps.pull.outputs.pull-request-head-sha }} - files: "*.tgz" \ No newline at end of file diff --git a/binding.yaml b/binding.yaml index 8847d26..db8e6b5 100644 --- a/binding.yaml +++ b/binding.yaml @@ -1,67 +1,74 @@ -- name: wginterface - ncflags: - - "-fno-exceptions" - nflags_cc: - - "-fno-exceptions" - defines: - - "NAPI_DISABLE_CPP_EXCEPTIONS" - - "NODE_VERSION=4" - cflags: - - "-fpermissive" - - "-fexceptions" - - "-w" - - "-fpermissive" - flags_cc: - - "-fpermissive" - - "-fexceptions" - - "-w" - - "-fpermissive" - includes: - - addons/genKey - - addons/tools - - node_modules/node-addon-api - sources: - - "addons/genKey/wgkeys.cpp" - - "addons/tools/wginterface.cpp" - - "addons/tools/wginterface-dummy.cpp" - target: - linux: - sources: - - "addons/tools/linux/wireguard.c" - - "addons/tools/wginterface-linux.cpp" - - "!addons/tools/wginterface-dummy.cpp" - defines: - - "LISTDEV" - - "GETCONFIG" - - "SETCONFIG" - - "DELIFACE" - cflags: - - "-fPIC" - flags_cc: - - "-fPIC" - macos: - cflags_cc: - - "-fexceptions" - cflags: - - "-fexceptions" - windows: - sources: - - "addons/tools/wginterface-win.cpp" - - "!addons/tools/wginterface-dummy.cpp" - includes: - - "addons/tools/win" - defines: - - "ONSTARTADDON" - - "LISTDEV" - - "GETCONFIG" - - "SETCONFIG" - - "DELIFACE" - - "_HAS_EXCEPTIONS=1" - libraries: - - "bcrypt.lib" - - "crypt32.lib" - - "iphlpapi.lib" - - "kernel32.lib" - - "ntdll.lib" - - "ws2_32.lib" - - "setupapi.lib" \ No newline at end of file +name: wginterface +flags: + - "!-fno-exceptions" + - "-fpermissive" + - "-fexceptions" + - "-w" + - "-fpermissive" +flagsCC: + - "!-fno-exceptions" + - "-fpermissive" + - "-fexceptions" + - "-w" + - "-fpermissive" +defines: + - "NAPI_DISABLE_CPP_EXCEPTIONS" + - "NODE_VERSION=4" +includes: + - addons/genKey + - addons/tools + - node_modules/node-addon-api +sources: + - "addons/genKey/wgkeys.cpp" + - "addons/tools/wginterface.cpp" + - "addons/tools/wginterface-dummy.cpp" +target: + linux: + sources: + - "addons/tools/linux/wireguard.c" + - "addons/tools/wginterface-linux.cpp" + - "!addons/tools/wginterface-dummy.cpp" + defines: + - "LISTDEV" + - "GETCONFIG" + - "SETCONFIG" + - "DELIFACE" + target: + x86_64: + release: true + flags: + - "-fPIC" + flagsCC: + - "-fPIC" + aarch64: + release: true + flags: + - "-fPIC" + flagsCC: + - "-fPIC" + windows: + target: + x86_64: + release: true + aarch64: + release: true + sources: + - "addons/tools/wginterface-win.cpp" + - "!addons/tools/wginterface-dummy.cpp" + includes: + - "addons/tools/win" + defines: + - "ONSTARTADDON" + - "LISTDEV" + - "GETCONFIG" + - "SETCONFIG" + - "DELIFACE" + - "_HAS_EXCEPTIONS=1" + libraries: + - "bcrypt.lib" + - "crypt32.lib" + - "iphlpapi.lib" + - "kernel32.lib" + - "ntdll.lib" + - "ws2_32.lib" + - "setupapi.lib" \ No newline at end of file