diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8563e9666..66fad8c70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -482,52 +482,8 @@ jobs: || eval $OUTPUT_PUBLISH_FAILED rm -r assets/MAA-pip-pkgs - - uses: JS-DevTools/npm-publish@v3 + - uses: ./.github/workflows/publish_nodejs.yml id: nodejs - with: - package: assets/MAA-nodejs-package/maa-node - access: public - token: ${{ secrets.NPM_TOKEN }} - - - uses: JS-DevTools/npm-publish@v3 - with: - package: assets/MAA-nodejs-package/maa-node-win32-x64 - access: public - token: ${{ secrets.NPM_TOKEN }} - - - uses: JS-DevTools/npm-publish@v3 - with: - package: assets/MAA-nodejs-package/maa-node-win32-arm64 - access: public - token: ${{ secrets.NPM_TOKEN }} - - - uses: JS-DevTools/npm-publish@v3 - with: - package: assets/MAA-nodejs-package/maa-node-linux-x64 - access: public - token: ${{ secrets.NPM_TOKEN }} - - - uses: JS-DevTools/npm-publish@v3 - with: - package: assets/MAA-nodejs-package/maa-node-linux-arm64 - access: public - token: ${{ secrets.NPM_TOKEN }} - - - uses: JS-DevTools/npm-publish@v3 - with: - package: assets/MAA-nodejs-package/maa-node-darwin-x64 - access: public - token: ${{ secrets.NPM_TOKEN }} - - - uses: JS-DevTools/npm-publish@v3 - with: - package: assets/MAA-nodejs-package/maa-node-darwin-arm64 - access: public - token: ${{ secrets.NPM_TOKEN }} - - - name: Remove NodeJS Release - run: | - rm -r assets/MAA-nodejs-package - run: | cd assets @@ -542,7 +498,7 @@ jobs: prerelease: ${{ needs.meta.outputs.is_pre_release == 'true' }} - name: Create issue if failed to release - if: steps.nuget.outputs.failed || steps.pip.outputs.failed || ${{ steps.nodejs.outputs.id == 'undefined' }} + if: failure() || steps.nuget.outputs.failed || steps.pip.outputs.failed || steps.nodejs.outputs.failed uses: actions-cool/issues-helper@v3 with: actions: "create-issue" @@ -551,4 +507,6 @@ jobs: Please manually publish the following packages: ${{ steps.nuget.outputs.failed && '- nuget @moomiji' || '' }} ${{ steps.pip.outputs.failed && '- pip @MistEO' || '' }} - ${{ steps.nodejs.outputs.id == 'undefined' && '- nodejs @neko-para' || '' }} + ${{ steps.nodejs.outputs.failed && '- nodejs @neko-para' || '' }} + + cc @MistEO diff --git a/.github/workflows/publish_nodejs.yml b/.github/workflows/publish_nodejs.yml index 63b602a34..1e4a29581 100644 --- a/.github/workflows/publish_nodejs.yml +++ b/.github/workflows/publish_nodejs.yml @@ -2,7 +2,10 @@ name: publish nodejs package on: workflow_dispatch: - + workflow_call: + outputs: + failed: + value: ${{ jobs.publish.outputs.failed }} jobs: publish: runs-on: ubuntu-latest @@ -57,3 +60,12 @@ jobs: package: assets/MAA-nodejs-package/maa-node-darwin-arm64 access: public token: ${{ secrets.NPM_TOKEN }} + + - name: Output Failure + id: output_failure + if: failure() + run: | + echo "failed=true" >> $GITHUB_OUTPUT && echo "::error::Failed to publish packages" + + outputs: + failed: ${{ steps.set.output_failure.failed }}