Skip to content

Commit

Permalink
ci: refactor puslish
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Dec 20, 2024
1 parent 3a72feb commit 0c88b17
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 48 deletions.
52 changes: 5 additions & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
14 changes: 13 additions & 1 deletion .github/workflows/publish_nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}

0 comments on commit 0c88b17

Please sign in to comment.