From 0bed3a6d41125410c948d144c3f612c7ab652b8f Mon Sep 17 00:00:00 2001 From: Shahar Kazaz Date: Thu, 6 Nov 2025 17:56:32 +0200 Subject: [PATCH 1/8] refactor: split release job into independent jobs in separate workflow - Extract release jobs from ci.yml to new release.yml workflow - Split monolithic release into 4 independent jobs (cargo, 2x npm, github) - Use workflow_call for explicit release triggering from CI - Enable parallel execution and individual job retry on failure --- .github/workflows/ci.yml | 43 ++----------------- .github/workflows/release.yml | 77 +++++++++++++++++++++++++++++++++++ .gitignore | 2 + 3 files changed, 82 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f76f8e0..621ae6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,7 +154,7 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: package-${{ matrix.target.rust }} + name: protofetch_${{ matrix.target.rust }} path: protofetch_${{ matrix.target.rust }}.tar.gz test-npm-package: @@ -255,44 +255,7 @@ jobs: fi release: - runs-on: ubuntu-latest if: github.repository == 'coralogix/protofetch' && startsWith(github.ref, 'refs/tags/') needs: [ package, test-npm-package ] - env: - CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Publish cargo package - run: cargo publish --token ${{ env.CRATES_IO_TOKEN }} - - - name: Publish npm package (cx-protofetch) - run: | - node .github/npm/prepare-package.js --package cx-protofetch - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ".npmrc" - npm publish .github/npm/dist/cx-protofetch - - - name: Publish npm package (@coralogix/protofetch) - run: | - node .github/npm/prepare-package.js --package coralogix-protofetch - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ".npmrc" - npm publish .github/npm/dist/coralogix-protofetch - - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - pattern: package-* - merge-multiple: true - - - name: Upload release artifacts - uses: softprops/action-gh-release@v1 - with: - files: | - protofetch_aarch64-unknown-linux-musl.tar.gz - protofetch_x86_64-unknown-linux-musl.tar.gz - protofetch_aarch64-apple-darwin.tar.gz - protofetch_x86_64-apple-darwin.tar.gz - protofetch_x86_64-pc-windows-msvc.tar.gz + uses: ./.github/workflows/release.yml + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..75e6e4e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,77 @@ +on: + workflow_call: + +name: Release + +env: + CARGO_TERM_COLOR: always + +jobs: + release-cargo: + runs-on: ubuntu-latest + if: github.repository == 'coralogix/protofetch' + env: + CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Publish cargo package + run: cargo publish --token ${{ env.CRATES_IO_TOKEN }} + + release-npm-cx-protofetch: + runs-on: ubuntu-latest + if: github.repository == 'coralogix/protofetch' + env: + NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Publish npm package (cx-protofetch) + run: | + node .github/npm/prepare-package.js --package cx-protofetch + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ".npmrc" + npm publish .github/npm/dist/cx-protofetch + + release-npm-coralogix-protofetch: + runs-on: ubuntu-latest + if: github.repository == 'coralogix/protofetch' + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Publish npm package (@coralogix/protofetch) + run: | + node .github/npm/prepare-package.js --package coralogix-protofetch + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ".npmrc" + npm publish .github/npm/dist/coralogix-protofetch + + release-github: + runs-on: ubuntu-latest + if: github.repository == 'coralogix/protofetch' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: package-* + merge-multiple: true + + - name: Upload release artifacts + uses: softprops/action-gh-release@v1 + with: + files: | + protofetch_aarch64-unknown-linux-musl.tar.gz + protofetch_x86_64-unknown-linux-musl.tar.gz + protofetch_aarch64-apple-darwin.tar.gz + protofetch_x86_64-apple-darwin.tar.gz + protofetch_x86_64-pc-windows-msvc.tar.gz diff --git a/.gitignore b/.gitignore index 16eac18..ba0d852 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ target/ *.pdb # End of https://www.toptal.com/developers/gitignore/api/rust + +.idea From e6949bfa3d1b031c1538073bb7b0a2b4d931b1b4 Mon Sep 17 00:00:00 2001 From: Shahar Kazaz Date: Thu, 6 Nov 2025 17:58:40 +0200 Subject: [PATCH 2/8] fix pattern --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75e6e4e..546ae95 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,7 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - pattern: package-* + pattern: protofetch_* merge-multiple: true - name: Upload release artifacts From 887ca240dfaa1ab9b1b42385dd0efc1a8422d707 Mon Sep 17 00:00:00 2001 From: Shahar Kazaz Date: Thu, 6 Nov 2025 18:37:37 +0200 Subject: [PATCH 3/8] revert name change --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 621ae6f..00e6174 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,7 +154,7 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: protofetch_${{ matrix.target.rust }} + name: package-${{ matrix.target.rust }} path: protofetch_${{ matrix.target.rust }}.tar.gz test-npm-package: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 546ae95..75e6e4e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,7 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - pattern: protofetch_* + pattern: package-* merge-multiple: true - name: Upload release artifacts From 6cef8b7821cb405cc1b85ffa8497dc24149fda5c Mon Sep 17 00:00:00 2001 From: Shahar Kazaz Date: Thu, 6 Nov 2025 18:38:12 +0200 Subject: [PATCH 4/8] remove job name prefix --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75e6e4e..73daf81 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ env: CARGO_TERM_COLOR: always jobs: - release-cargo: + cargo: runs-on: ubuntu-latest if: github.repository == 'coralogix/protofetch' env: @@ -20,7 +20,7 @@ jobs: - name: Publish cargo package run: cargo publish --token ${{ env.CRATES_IO_TOKEN }} - release-npm-cx-protofetch: + npm-cx-protofetch: runs-on: ubuntu-latest if: github.repository == 'coralogix/protofetch' env: @@ -36,7 +36,7 @@ jobs: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ".npmrc" npm publish .github/npm/dist/cx-protofetch - release-npm-coralogix-protofetch: + npm-coralogix-protofetch: runs-on: ubuntu-latest if: github.repository == 'coralogix/protofetch' env: @@ -52,7 +52,7 @@ jobs: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ".npmrc" npm publish .github/npm/dist/coralogix-protofetch - release-github: + github: runs-on: ubuntu-latest if: github.repository == 'coralogix/protofetch' From 2d6bd9ee491a0ff1cf8e22cd4e03b027ba1db5b0 Mon Sep 17 00:00:00 2001 From: Shahar Kazaz Date: Thu, 6 Nov 2025 18:48:21 +0200 Subject: [PATCH 5/8] use org npm token --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73daf81..ef2a453 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'coralogix/protofetch' env: - NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} steps: - name: Checkout From e7fca3b6956ff5023e7f3b4f0cceff399c29437a Mon Sep 17 00:00:00 2001 From: Shahar Kazaz Date: Thu, 6 Nov 2025 19:50:13 +0200 Subject: [PATCH 6/8] use old token --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef2a453..73daf81 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'coralogix/protofetch' env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} steps: - name: Checkout From bd57452fa1dbe7f3cc7e41deb506d387740b4ea0 Mon Sep 17 00:00:00 2001 From: Shahar Kazaz Date: Fri, 7 Nov 2025 07:46:23 +0200 Subject: [PATCH 7/8] depend npm release on github --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73daf81..5034389 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,7 @@ jobs: npm-cx-protofetch: runs-on: ubuntu-latest + needs: [ github ] if: github.repository == 'coralogix/protofetch' env: NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} @@ -38,6 +39,7 @@ jobs: npm-coralogix-protofetch: runs-on: ubuntu-latest + needs: [ github ] if: github.repository == 'coralogix/protofetch' env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From e71465fc2a71a268fd0b8ca7346c471b64b45cfa Mon Sep 17 00:00:00 2001 From: Shahar Kazaz Date: Sun, 9 Nov 2025 08:12:09 +0200 Subject: [PATCH 8/8] remove ide ignore --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index ba0d852..16eac18 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,3 @@ target/ *.pdb # End of https://www.toptal.com/developers/gitignore/api/rust - -.idea