From 53a9b864fe7b04bf36ab303308be31e3796e297b Mon Sep 17 00:00:00 2001 From: Bogdan Condurache Date: Wed, 13 Dec 2023 13:10:16 +0200 Subject: [PATCH 1/7] initial commit --- .github/workflows/publish-node.yaml | 62 ++++++++++++++--------------- postinstall.js | 7 +++- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/.github/workflows/publish-node.yaml b/.github/workflows/publish-node.yaml index b56511d..f2affbc 100644 --- a/.github/workflows/publish-node.yaml +++ b/.github/workflows/publish-node.yaml @@ -32,7 +32,7 @@ jobs: run: npm install - name: Build package - run: npm run build-release + run: node -e "console.log(process.arch)" && npm run build-release - name: Run test run: npm start @@ -48,33 +48,33 @@ jobs: name: binary-${{ matrix.os }} path: ./binaries/index-${{ matrix.os }}.node - publish: - needs: build - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: '18' - registry-url: 'https://npm.pkg.github.com/' - scope: '@robocorp' - - - name: Download all artifacts - uses: actions/download-artifact@v2 - with: - path: ./artifacts - - - name: Prepare package - run: | - mkdir -p ./binaries - mv ./artifacts/binary-ubuntu-latest/index-ubuntu-latest.node ./binaries/ - mv ./artifacts/binary-windows-latest/index-windows-latest.node ./binaries/ - mv ./artifacts/binary-macos-latest/index-macos-latest.node ./binaries/ - - - name: Publish to GitHub Packages - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + # publish: + # needs: build + # runs-on: ubuntu-latest + + # steps: + # - uses: actions/checkout@v2 + + # - name: Set up Node.js + # uses: actions/setup-node@v2 + # with: + # node-version: '18' + # registry-url: 'https://npm.pkg.github.com/' + # scope: '@robocorp' + + # - name: Download all artifacts + # uses: actions/download-artifact@v2 + # with: + # path: ./artifacts + + # - name: Prepare package + # run: | + # mkdir -p ./binaries + # mv ./artifacts/binary-ubuntu-latest/index-ubuntu-latest.node ./binaries/ + # mv ./artifacts/binary-windows-latest/index-windows-latest.node ./binaries/ + # mv ./artifacts/binary-macos-latest/index-macos-latest.node ./binaries/ + + # - name: Publish to GitHub Packages + # run: npm publish + # env: + # NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/postinstall.js b/postinstall.js index 74d839f..121daf5 100644 --- a/postinstall.js +++ b/postinstall.js @@ -3,6 +3,7 @@ const path = require('path'); const binariesDir = path.join(__dirname, 'binaries'); const osType = process.platform; +const cpuArch = process.arch; let binaryName; switch (osType) { @@ -13,7 +14,11 @@ switch (osType) { binaryName = 'index-ubuntu-latest.node'; break; case 'darwin': - binaryName = 'index-macos-latest.node'; + if (cpuArch === 'arm' || cpuArch === 'arm64') { + binaryName = 'index-macos-arm-latest.node'; + } else { + binaryName = 'index-macos-latest.node'; + } break; default: throw new Error(`Unsupported platform: ${osType}`); From 4f053ad4d54ecd04d821ad0436b62e72a80088b5 Mon Sep 17 00:00:00 2001 From: Bogdan Condurache Date: Wed, 13 Dec 2023 13:14:32 +0200 Subject: [PATCH 2/7] workflow dispatch --- .github/workflows/publish-node.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish-node.yaml b/.github/workflows/publish-node.yaml index f2affbc..b45f4cc 100644 --- a/.github/workflows/publish-node.yaml +++ b/.github/workflows/publish-node.yaml @@ -1,6 +1,8 @@ name: Publish Node Addon on: + workflow_dispatch: + # Enables manual triggering via GitHub Actions push: tags: - 'v*' From 157ce13978f77e522b20193d7f89bbc0055eba57 Mon Sep 17 00:00:00 2001 From: Bogdan Condurache Date: Wed, 13 Dec 2023 13:32:24 +0200 Subject: [PATCH 3/7] add macos-latest-xlarge --- .github/workflows/publish-node.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-node.yaml b/.github/workflows/publish-node.yaml index b45f4cc..edb87f1 100644 --- a/.github/workflows/publish-node.yaml +++ b/.github/workflows/publish-node.yaml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-xlarge] steps: - name: Check out the code From e2cdc61a3a52807c3def44b3a239e7b2001610c3 Mon Sep 17 00:00:00 2001 From: Bogdan Condurache Date: Thu, 14 Dec 2023 01:25:50 +0200 Subject: [PATCH 4/7] change to macos-large and handle postinstall --- .github/workflows/publish-node.yaml | 62 +++++++++++++++-------------- postinstall.js | 2 +- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/.github/workflows/publish-node.yaml b/.github/workflows/publish-node.yaml index edb87f1..af3cb28 100644 --- a/.github/workflows/publish-node.yaml +++ b/.github/workflows/publish-node.yaml @@ -9,6 +9,7 @@ on: jobs: build: + timeout-minutes: 5 runs-on: ${{ matrix.os }} strategy: @@ -50,33 +51,34 @@ jobs: name: binary-${{ matrix.os }} path: ./binaries/index-${{ matrix.os }}.node - # publish: - # needs: build - # runs-on: ubuntu-latest - - # steps: - # - uses: actions/checkout@v2 - - # - name: Set up Node.js - # uses: actions/setup-node@v2 - # with: - # node-version: '18' - # registry-url: 'https://npm.pkg.github.com/' - # scope: '@robocorp' - - # - name: Download all artifacts - # uses: actions/download-artifact@v2 - # with: - # path: ./artifacts - - # - name: Prepare package - # run: | - # mkdir -p ./binaries - # mv ./artifacts/binary-ubuntu-latest/index-ubuntu-latest.node ./binaries/ - # mv ./artifacts/binary-windows-latest/index-windows-latest.node ./binaries/ - # mv ./artifacts/binary-macos-latest/index-macos-latest.node ./binaries/ - - # - name: Publish to GitHub Packages - # run: npm publish - # env: - # NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + publish: + needs: build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + registry-url: 'https://npm.pkg.github.com/' + scope: '@robocorp' + + - name: Download all artifacts + uses: actions/download-artifact@v2 + with: + path: ./artifacts + + - name: Prepare package + run: | + mkdir -p ./binaries + mv ./artifacts/binary-ubuntu-latest/index-ubuntu-latest.node ./binaries/ + mv ./artifacts/binary-windows-latest/index-windows-latest.node ./binaries/ + mv ./artifacts/binary-macos-latest/index-macos-latest.node ./binaries/ + mv ./artifacts/binary-macos-latest/index-macos-latest-large.node ./binaries/index-macos-arm-latest.node + + - name: Publish to GitHub Packages + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/postinstall.js b/postinstall.js index 121daf5..0fb2ced 100644 --- a/postinstall.js +++ b/postinstall.js @@ -15,7 +15,7 @@ switch (osType) { break; case 'darwin': if (cpuArch === 'arm' || cpuArch === 'arm64') { - binaryName = 'index-macos-arm-latest.node'; + binaryName = 'index-macos-arm-latest.node'; } else { binaryName = 'index-macos-latest.node'; } From 72a03520f64035fef80fc3384bd5eac49d6bb752 Mon Sep 17 00:00:00 2001 From: Bogdan Condurache Date: Thu, 14 Dec 2023 01:32:47 +0200 Subject: [PATCH 5/7] small fix --- .github/workflows/publish-node.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-node.yaml b/.github/workflows/publish-node.yaml index af3cb28..b27e47f 100644 --- a/.github/workflows/publish-node.yaml +++ b/.github/workflows/publish-node.yaml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-xlarge] + os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large] steps: - name: Check out the code From b881be660968475bc10ea5e1478985b01f0171ea Mon Sep 17 00:00:00 2001 From: Bogdan Condurache Date: Thu, 14 Dec 2023 01:41:45 +0200 Subject: [PATCH 6/7] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f466bdc..c8e57cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@robocorp/native-certs", - "version": "0.1.3", + "version": "0.2.0", "description": "", "main": "index.node", "module": "index.node", From db72af1468784298d795aa54e1e44d3d8c69629d Mon Sep 17 00:00:00 2001 From: Bogdan Condurache Date: Thu, 14 Dec 2023 01:45:03 +0200 Subject: [PATCH 7/7] Update .github/workflows/publish-node.yaml --- .github/workflows/publish-node.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-node.yaml b/.github/workflows/publish-node.yaml index b27e47f..8b5cc06 100644 --- a/.github/workflows/publish-node.yaml +++ b/.github/workflows/publish-node.yaml @@ -35,7 +35,7 @@ jobs: run: npm install - name: Build package - run: node -e "console.log(process.arch)" && npm run build-release + run: npm run build-release - name: Run test run: npm start