@@ -34,106 +34,34 @@ jobs:
3434 with :
3535 github_token : ${{ secrets.GITHUB_TOKEN }}
3636
37- build :
37+ publish-npm :
3838 needs : release
39- if : (github.event_name == 'push' && needs.release.outputs.released == 'true') || github.event_name == 'workflow_dispatch'
40- strategy :
41- fail-fast : false
42- matrix :
43- include :
44- - runner : ubuntu-22.04
45- name : linux-amd64
46- - runner : windows-latest
47- name : windows-amd64
48- - runner : macos-14
49- name : darwin-arm64
50- - runner : macos-15-intel
51- name : darwin-amd64
52-
53- runs-on : ${{ matrix.runner }}
54-
39+ runs-on : ubuntu-latest
40+ if : ((github.event_name == 'push' && needs.release.outputs.released == 'true') || github.event_name == 'workflow_dispatch') && hashFiles('package.json') != ''
5541 steps :
5642 - uses : actions/checkout@v4
5743 with :
5844 ref : ${{ inputs.ref || needs.release.outputs.tag || github.sha }}
5945
60- - name : Set up Python
61- uses : actions/setup-python@v5
46+ - name : Setup Node.js
47+ uses : actions/setup-node@v4
6248 with :
63- python-version : " 3.11"
49+ node-version : " 20"
50+ registry-url : " https://registry.npmjs.org"
6451
65- - name : Install uv
66- uses : astral-sh/setup-uv@v4
67-
68- - name : Install dependencies (uv)
69- shell : bash
70- run : |
71- uv sync --no-install-project
72- uv pip install pyinstaller
73-
74- - name : Build executable (PyInstaller onedir)
75- shell : bash
76- run : |
77- if [ "${{ runner.os }}" = "Windows" ]; then
78- .venv/Scripts/python.exe -m PyInstaller hackbot.spec
79- else
80- .venv/bin/python -m PyInstaller hackbot.spec
81- fi
82-
83- - name : Create release README (in package)
84- shell : bash
52+ - name : Publish to npm
8553 env :
86- RELEASE_VERSION : ${{ needs.release.outputs.version || needs.release.outputs.tag || github.ref_name }}
87- PLATFORM_NAME : ${{ matrix.name }}
88- run : |
89- python -m utils.release_docs package-readme \
90- --changelog CHANGELOG.md \
91- --version "${RELEASE_VERSION}" \
92- --platform "${PLATFORM_NAME}" \
93- --output dist/hackbot/README_RELEASE.md \
94- --project-name "Secbot"
95- cp README.md dist/hackbot/README.md
96-
97- - name : Package artifact (zip)
98- shell : bash
99- run : |
100- if [ "${{ runner.os }}" = "Windows" ]; then
101- python -c "import shutil,os; os.chdir('dist'); shutil.make_archive('secbot-${{ matrix.name }}', 'zip', '.', 'hackbot')"
102- else
103- .venv/bin/python -c "import shutil,os; os.chdir('dist'); shutil.make_archive('secbot-${{ matrix.name }}', 'zip', '.', 'hackbot')"
104- fi
105-
106- - name : Upload artifact
107- uses : actions/upload-artifact@v4
108- with :
109- name : secbot-${{ matrix.name }}
110- path : dist/secbot-${{ matrix.name }}.zip
111-
112- upload-assets :
113- needs : [release, build]
114- runs-on : ubuntu-latest
115- if : github.event_name == 'push' && needs.release.outputs.released == 'true'
116- steps :
117- - name : Download all artifacts
118- uses : actions/download-artifact@v4
119- with :
120- path : artifacts
121-
122- - name : Upload release assets
123- uses : softprops/action-gh-release@v2
124- with :
125- tag_name : ${{ needs.release.outputs.tag }}
126- files : artifacts/**/*.zip
127- env :
128- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
54+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
55+ run : npm publish --access public
12956
13057 publish-pypi :
58+ needs : release
13159 runs-on : ubuntu-latest
132- if : github.event_name == 'workflow_dispatch'
60+ if : (github.event_name == 'push' && needs.release.outputs.released == 'true') || github.event_name == 'workflow_dispatch'
13361 steps :
13462 - uses : actions/checkout@v4
13563 with :
136- ref : ${{ inputs.ref || github.ref }}
64+ ref : ${{ inputs.ref || needs.release.outputs.tag || github.sha }}
13765
13866 - name : Set up Python
13967 uses : actions/setup-python@v5
0 commit comments