From 7b66ac5c6290929a6af601088699821a9d6e4ffb Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 5 Mar 2025 08:21:35 -0500 Subject: [PATCH 1/9] upgrade the Node.js runner --- .github/workflows/node-sdk.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/node-sdk.yml b/.github/workflows/node-sdk.yml index 8645c3bf..4f3b7daa 100644 --- a/.github/workflows/node-sdk.yml +++ b/.github/workflows/node-sdk.yml @@ -31,7 +31,8 @@ jobs: needs: enforce_stable_semver if: always() name: Build for Node-${{ matrix.node_ver }} ${{ matrix.config.target }}/${{ matrix.config.arch }} - runs-on: ${{ matrix.config.os }} + runs-on: ${{ matrix.config.runs-on }} + container: ${{ matrix.config.container }} env: BUILD_NUMBER: ${{ github.run_number }} @@ -40,7 +41,7 @@ jobs: strategy: matrix: config: - - { os: ubuntu-20.04, target: "linux", arch: "x64" } + - { runs-on: ubuntu-24.04, container: openziti/ziti-builder:v2, target: "linux", arch: "x64" } node_ver: [ 20 ] fail-fast: false From 1b55a01b4d4e9a4593edb555771a016f81f95df6 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 5 Mar 2025 08:30:19 -0500 Subject: [PATCH 2/9] add GH token for fetching submodules --- .github/workflows/node-sdk.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/node-sdk.yml b/.github/workflows/node-sdk.yml index 4f3b7daa..7b9ea5ad 100644 --- a/.github/workflows/node-sdk.yml +++ b/.github/workflows/node-sdk.yml @@ -57,6 +57,7 @@ jobs: with: fetch-depth: 0 submodules: 'recursive' + token: ${{ secrets.GITHUB_TOKEN }} - name: Get current zrok repo tag id: tag From 29c6d85b19cf8395ccfbad625c6fb3abce284c16 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 5 Mar 2025 08:38:43 -0500 Subject: [PATCH 3/9] try to stop recursing submodules --- .github/workflows/node-sdk.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/node-sdk.yml b/.github/workflows/node-sdk.yml index 7b9ea5ad..06e3cbda 100644 --- a/.github/workflows/node-sdk.yml +++ b/.github/workflows/node-sdk.yml @@ -33,10 +33,10 @@ jobs: name: Build for Node-${{ matrix.node_ver }} ${{ matrix.config.target }}/${{ matrix.config.arch }} runs-on: ${{ matrix.config.runs-on }} container: ${{ matrix.config.container }} - env: BUILD_NUMBER: ${{ github.run_number }} AWS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + # GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} strategy: matrix: @@ -54,10 +54,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: 'recursive' - token: ${{ secrets.GITHUB_TOKEN }} + # with: + # fetch-depth: 0 + # submodules: recursive + # token: ${{ secrets.GITHUB_TOKEN }} + + # - name: Configure Git Authentication + # run: | + # git config --global url."https://x-access-token:${GITHUB_PAT}@github.com/".insteadOf "https://github.com/" - name: Get current zrok repo tag id: tag From 4948200c0ce8eb2c118c180f5309c018feb6a32a Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 5 Mar 2025 08:51:40 -0500 Subject: [PATCH 4/9] fix workspace paths in container runner --- .github/workflows/node-sdk.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/node-sdk.yml b/.github/workflows/node-sdk.yml index 06e3cbda..d490eedf 100644 --- a/.github/workflows/node-sdk.yml +++ b/.github/workflows/node-sdk.yml @@ -54,8 +54,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - # with: - # fetch-depth: 0 + with: + fetch-depth: 0 # submodules: recursive # token: ${{ secrets.GITHUB_TOKEN }} @@ -64,13 +64,14 @@ jobs: # git config --global url."https://x-access-token:${GITHUB_PAT}@github.com/".insteadOf "https://github.com/" - name: Get current zrok repo tag + if: github.ref_type == 'tag' id: tag - run: echo "TAG=$(git describe --tags --abbrev=0)" | tee -a $GITHUB_OUTPUT + run: echo "TAG=$(git describe --tags --always)" | tee -a $GITHUB_OUTPUT - name: Update zrok NodeJS-SDK's package.json version based on current zrok repo git tag if: github.ref_type == 'tag' run: | - cd ${{ runner.workspace }}/${{ github.event.repository.name }}/sdk/nodejs/sdk + cd sdk/nodejs/sdk npm version ${{ steps.tag.outputs.TAG }} --no-git-tag-version --allow-same-version - name: Setup .npmrc @@ -83,7 +84,7 @@ jobs: - name: Build the zrok NodeJS-SDK run: | - cd ${{ runner.workspace }}/${{ github.event.repository.name }}/sdk/nodejs/sdk + cd sdk/nodejs/sdk npm install npm run build env: @@ -92,7 +93,7 @@ jobs: - name: NPM Publish if: github.ref_type == 'tag' run: | - cd ${{ runner.workspace }}/${{ github.event.repository.name }}/sdk/nodejs/sdk + cd sdk/nodejs/sdk npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From ed26f08d3b90cca14a3455951747b075ed61aa86 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 5 Mar 2025 08:53:54 -0500 Subject: [PATCH 5/9] stop recursing unused submodules --- .github/workflows/node-sdk.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/node-sdk.yml b/.github/workflows/node-sdk.yml index d490eedf..ed1eb995 100644 --- a/.github/workflows/node-sdk.yml +++ b/.github/workflows/node-sdk.yml @@ -36,15 +36,14 @@ jobs: env: BUILD_NUMBER: ${{ github.run_number }} AWS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - + strategy: matrix: config: - { runs-on: ubuntu-24.04, container: openziti/ziti-builder:v2, target: "linux", arch: "x64" } node_ver: [ 20 ] fail-fast: false - + steps: - name: Node Version @@ -56,12 +55,6 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - # submodules: recursive - # token: ${{ secrets.GITHUB_TOKEN }} - - # - name: Configure Git Authentication - # run: | - # git config --global url."https://x-access-token:${GITHUB_PAT}@github.com/".insteadOf "https://github.com/" - name: Get current zrok repo tag if: github.ref_type == 'tag' From 8bb0f970ec7f1f3fcc05f1bf5a687eadc60f2492 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 5 Mar 2025 09:04:26 -0500 Subject: [PATCH 6/9] let in-line shell run steps raise exceptions --- .github/workflows/node-sdk.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/node-sdk.yml b/.github/workflows/node-sdk.yml index ed1eb995..1457bf90 100644 --- a/.github/workflows/node-sdk.yml +++ b/.github/workflows/node-sdk.yml @@ -12,8 +12,6 @@ jobs: name: Require Stable Release Semver if: github.event.action == 'released' runs-on: ubuntu-24.04 - outputs: - version: ${{ steps.parse.outputs.version }} steps: - name: Parse Release Version id: parse @@ -59,10 +57,12 @@ jobs: - name: Get current zrok repo tag if: github.ref_type == 'tag' id: tag + shell: bash run: echo "TAG=$(git describe --tags --always)" | tee -a $GITHUB_OUTPUT - name: Update zrok NodeJS-SDK's package.json version based on current zrok repo git tag if: github.ref_type == 'tag' + shell: bash run: | cd sdk/nodejs/sdk npm version ${{ steps.tag.outputs.TAG }} --no-git-tag-version --allow-same-version @@ -76,6 +76,7 @@ jobs: registry-url: 'https://registry.npmjs.org' - name: Build the zrok NodeJS-SDK + shell: bash run: | cd sdk/nodejs/sdk npm install @@ -85,6 +86,7 @@ jobs: - name: NPM Publish if: github.ref_type == 'tag' + shell: bash run: | cd sdk/nodejs/sdk npm publish --access public From 8822082b1bbfb94a5fd9c700aeffb26c01d9e62e Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 5 Mar 2025 09:26:36 -0500 Subject: [PATCH 7/9] stop building Node.js in a container runner because the newest required glibc for dependencies is 2.29 and is pre-built --- .github/workflows/node-sdk.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/node-sdk.yml b/.github/workflows/node-sdk.yml index 1457bf90..65506125 100644 --- a/.github/workflows/node-sdk.yml +++ b/.github/workflows/node-sdk.yml @@ -29,8 +29,7 @@ jobs: needs: enforce_stable_semver if: always() name: Build for Node-${{ matrix.node_ver }} ${{ matrix.config.target }}/${{ matrix.config.arch }} - runs-on: ${{ matrix.config.runs-on }} - container: ${{ matrix.config.container }} + runs-on: ${{ matrix.config.os }} env: BUILD_NUMBER: ${{ github.run_number }} AWS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} @@ -38,7 +37,7 @@ jobs: strategy: matrix: config: - - { runs-on: ubuntu-24.04, container: openziti/ziti-builder:v2, target: "linux", arch: "x64" } + - { os: ubuntu-24.04, target: "linux", arch: "x64" } node_ver: [ 20 ] fail-fast: false From d7e0faa468cf73383d51b72201720d40bf112611 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 5 Mar 2025 09:31:46 -0500 Subject: [PATCH 8/9] stop publishing to npm registry with @latest on canary releases --- .github/workflows/node-sdk.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/node-sdk.yml b/.github/workflows/node-sdk.yml index 65506125..6612e389 100644 --- a/.github/workflows/node-sdk.yml +++ b/.github/workflows/node-sdk.yml @@ -88,6 +88,13 @@ jobs: shell: bash run: | cd sdk/nodejs/sdk - npm publish --access public + # Check if this is the official repository + if [[ "${{ github.repository_owner }}" == "openziti" ]]; then + echo "Publishing from official repository with @latest tag" + npm publish --access public + else + echo "Publishing from fork/test repository with @canary tag" + npm publish --access public --tag canary + fi env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From d37ecd982c66835042b395982828049d90e6e34d Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 5 Mar 2025 09:41:41 -0500 Subject: [PATCH 9/9] trigger release consistently with a release event --- .github/workflows/node-sdk.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/node-sdk.yml b/.github/workflows/node-sdk.yml index 6612e389..4d39f738 100644 --- a/.github/workflows/node-sdk.yml +++ b/.github/workflows/node-sdk.yml @@ -54,20 +54,20 @@ jobs: fetch-depth: 0 - name: Get current zrok repo tag - if: github.ref_type == 'tag' + if: github.event.action == 'released' id: tag shell: bash run: echo "TAG=$(git describe --tags --always)" | tee -a $GITHUB_OUTPUT - name: Update zrok NodeJS-SDK's package.json version based on current zrok repo git tag - if: github.ref_type == 'tag' + if: github.event.action == 'released' shell: bash run: | cd sdk/nodejs/sdk npm version ${{ steps.tag.outputs.TAG }} --no-git-tag-version --allow-same-version - name: Setup .npmrc - if: github.ref_type == 'tag' + if: github.event.action == 'released' # Setup .npmrc file to prepare for possible publish to npm uses: actions/setup-node@v4 with: @@ -84,7 +84,7 @@ jobs: BUILD_DATE: ${{ steps.date.outputs.date }} - name: NPM Publish - if: github.ref_type == 'tag' + if: github.event.action == 'released' shell: bash run: | cd sdk/nodejs/sdk