Skip to content

Commit d852d6b

Browse files
authored
Merge pull request #1 from ervan0707/feat/init-wizard
Feat/init wizard
2 parents 050d63f + 1960a61 commit d852d6b

File tree

10 files changed

+1045
-150
lines changed

10 files changed

+1045
-150
lines changed

.github/workflows/release.yml

Lines changed: 122 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
@semantic-release/exec
3636
env:
3737
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
38+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3939

4040
- name: Update Cargo.toml version
4141
if: steps.semantic.outputs.new_release_published == 'true'
@@ -253,125 +253,125 @@ jobs:
253253
args: --skip-existing wheels-*/*
254254
# args: --repository-url=https://test.pypi.org/legacy/ --skip-existing wheels-*/*
255255

256-
# publish-npm-packages:
257-
# name: Publish NPM Packages
258-
# needs: [prepare, build-platform-artifact, sdist]
259-
# if: needs.prepare.outputs.release_created == 'true'
260-
# runs-on: ubuntu-latest
261-
# continue-on-error: true
262-
263-
# steps:
264-
# - name: Checkout
265-
# uses: actions/checkout@v4
266-
267-
# - name: Install node
268-
# uses: actions/setup-node@v4
269-
# with:
270-
# node-version: "20"
271-
# registry-url: "https://registry.npmjs.org"
272-
273-
# Download platform artifacts and build info
274-
# - name: Download Platform Artifacts
275-
# uses: actions/download-artifact@v4
276-
# with:
277-
# pattern: thira-*
278-
# path: binary-dist
279-
# merge-multiple: true
280-
281-
# - name: Download build info
282-
# uses: actions/download-artifact@v4
283-
# with:
284-
# pattern: build-info-*
285-
# path: build-info
286-
287-
# - name: Publish to NPM
288-
# shell: bash
289-
# run: |
290-
# echo "VERSION: ${{needs.prepare.outputs.new_version}}"
291-
# cd packages/npm
292-
293-
# # Process each build artifact
294-
# for info_file in ../../build-info/build-info-*/build-info.json; do
295-
# # Parse build info
296-
# build_info=$(cat "$info_file")
297-
# build_name=$(echo "$build_info" | jq -r '.name')
298-
# build_os=$(echo "$build_info" | jq -r '.os')
299-
# binary_name=$(echo "$build_info" | jq -r '.binary_name')
300-
301-
# echo "Processing build info:"
302-
# echo " build_name: $build_name"
303-
# echo " build_os: $build_os"
304-
# echo " binary_name: $binary_name"
305-
306-
# # set the binary name
307-
# bin="thira"
308-
309-
# # derive the OS and architecture from the build name
310-
# node_os=$(echo "$build_name" | cut -d '-' -f1)
311-
# export node_os
312-
# node_arch=$(echo "$build_name" | cut -d '-' -f2)
313-
# export node_arch
314-
315-
# # set the version
316-
# export node_version="${{needs.prepare.outputs.new_version}}"
317-
318-
# # set the package name and artifact name
319-
# if [ "$build_os" = "windows-2022" ]; then
320-
# export node_pkg="${bin}-windows-${node_arch}"
321-
# if [ "$node_arch" = "x64" ]; then
322-
# artifact_name="thira-windows-x86_64"
323-
# else
324-
# artifact_name="thira-windows-arm64"
325-
# fi
326-
# else
327-
# export node_pkg="${bin}-${node_os}-${node_arch}"
328-
# if [ "$node_os" = "darwin" ]; then
329-
# if [ "$node_arch" = "x64" ]; then
330-
# artifact_name="thira-darwin-x86_64"
331-
# else
332-
# artifact_name="thira-darwin-arm64"
333-
# fi
334-
# else
335-
# if [ "$node_arch" = "x64" ]; then
336-
# artifact_name="thira-linux-x86_64"
337-
# else
338-
# artifact_name="thira-linux-arm64"
339-
# fi
340-
# fi
341-
# fi
342-
343-
# echo "Package name: $node_pkg"
344-
# echo "Artifact name: $artifact_name"
345-
346-
# # create the package directory
347-
# mkdir -p "${node_pkg}/bin"
348-
349-
# # generate package.json from the template
350-
# envsubst < package.json.tmpl > "${node_pkg}/package.json"
351-
352-
# # Extract and copy the binary based on OS
353-
# if [ "$build_os" = "windows-2022" ]; then
354-
# # For Windows (.zip)
355-
# echo "Extracting ../../binary-dist/${artifact_name}.zip"
356-
# unzip -j "../../binary-dist/${artifact_name}.zip" -d "${node_pkg}/bin/"
357-
# mv "${node_pkg}/bin/${artifact_name}.exe" "${node_pkg}/bin/${bin}.exe"
358-
# else
359-
# # For Unix (.tar.gz)
360-
# echo "Extracting ../../binary-dist/${artifact_name}.tar.gz"
361-
# tar -xzvf "../../binary-dist/${artifact_name}.tar.gz" -C "${node_pkg}/bin/"
362-
# mv "${node_pkg}/bin/${artifact_name}" "${node_pkg}/bin/${bin}"
363-
# fi
364-
365-
# echo "Contents of ${node_pkg}/bin:"
366-
# ls -la "${node_pkg}/bin"
367-
368-
# # publish the package
369-
# cd "${node_pkg}"
370-
# npm publish --access public
371-
# cd ../
372-
# done
373-
# env:
374-
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
256+
publish-npm-packages:
257+
name: Publish NPM Packages
258+
needs: [prepare, build-platform-artifact, sdist]
259+
if: needs.prepare.outputs.release_created == 'true'
260+
runs-on: ubuntu-latest
261+
continue-on-error: true
262+
263+
steps:
264+
- name: Checkout
265+
uses: actions/checkout@v4
266+
267+
- name: Install node
268+
uses: actions/setup-node@v4
269+
with:
270+
node-version: "20"
271+
registry-url: "https://registry.npmjs.org"
272+
273+
# Download platform artifacts and build info
274+
- name: Download Platform Artifacts
275+
uses: actions/download-artifact@v4
276+
with:
277+
pattern: thira-*
278+
path: binary-dist
279+
merge-multiple: true
280+
281+
- name: Download build info
282+
uses: actions/download-artifact@v4
283+
with:
284+
pattern: build-info-*
285+
path: build-info
286+
287+
- name: Publish to NPM
288+
shell: bash
289+
run: |
290+
echo "VERSION: ${{needs.prepare.outputs.new_version}}"
291+
cd packages/npm
292+
293+
# Process each build artifact
294+
for info_file in ../../build-info/build-info-*/build-info.json; do
295+
# Parse build info
296+
build_info=$(cat "$info_file")
297+
build_name=$(echo "$build_info" | jq -r '.name')
298+
build_os=$(echo "$build_info" | jq -r '.os')
299+
binary_name=$(echo "$build_info" | jq -r '.binary_name')
300+
301+
echo "Processing build info:"
302+
echo " build_name: $build_name"
303+
echo " build_os: $build_os"
304+
echo " binary_name: $binary_name"
305+
306+
# set the binary name
307+
bin="thira"
308+
309+
# derive the OS and architecture from the build name
310+
node_os=$(echo "$build_name" | cut -d '-' -f1)
311+
export node_os
312+
node_arch=$(echo "$build_name" | cut -d '-' -f2)
313+
export node_arch
314+
315+
# set the version
316+
export node_version="${{needs.prepare.outputs.new_version}}"
317+
318+
# set the package name and artifact name
319+
if [ "$build_os" = "windows-2022" ]; then
320+
export node_pkg="${bin}-windows-${node_arch}"
321+
if [ "$node_arch" = "x64" ]; then
322+
artifact_name="thira-windows-x86_64"
323+
else
324+
artifact_name="thira-windows-arm64"
325+
fi
326+
else
327+
export node_pkg="${bin}-${node_os}-${node_arch}"
328+
if [ "$node_os" = "darwin" ]; then
329+
if [ "$node_arch" = "x64" ]; then
330+
artifact_name="thira-darwin-x86_64"
331+
else
332+
artifact_name="thira-darwin-arm64"
333+
fi
334+
else
335+
if [ "$node_arch" = "x64" ]; then
336+
artifact_name="thira-linux-x86_64"
337+
else
338+
artifact_name="thira-linux-arm64"
339+
fi
340+
fi
341+
fi
342+
343+
echo "Package name: $node_pkg"
344+
echo "Artifact name: $artifact_name"
345+
346+
# create the package directory
347+
mkdir -p "${node_pkg}/bin"
348+
349+
# generate package.json from the template
350+
envsubst < package.json.tmpl > "${node_pkg}/package.json"
351+
352+
# Extract and copy the binary based on OS
353+
if [ "$build_os" = "windows-2022" ]; then
354+
# For Windows (.zip)
355+
echo "Extracting ../../binary-dist/${artifact_name}.zip"
356+
unzip -j "../../binary-dist/${artifact_name}.zip" -d "${node_pkg}/bin/"
357+
mv "${node_pkg}/bin/${artifact_name}.exe" "${node_pkg}/bin/${bin}.exe"
358+
else
359+
# For Unix (.tar.gz)
360+
echo "Extracting ../../binary-dist/${artifact_name}.tar.gz"
361+
tar -xzvf "../../binary-dist/${artifact_name}.tar.gz" -C "${node_pkg}/bin/"
362+
mv "${node_pkg}/bin/${artifact_name}" "${node_pkg}/bin/${bin}"
363+
fi
364+
365+
echo "Contents of ${node_pkg}/bin:"
366+
ls -la "${node_pkg}/bin"
367+
368+
# publish the package
369+
cd "${node_pkg}"
370+
npm publish --access public
371+
cd ../
372+
done
373+
env:
374+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
375375

376376
publish-cargo:
377377
name: Publish to crates.io
@@ -404,7 +404,7 @@ jobs:
404404
release:
405405
name: Create Release
406406
needs:
407-
[prepare, build-platform-artifact, publish-python-packages, publish-cargo]
407+
[prepare, build-platform-artifact, publish-python-packages, publish-cargo, publish-npm-packages]
408408
if: needs.prepare.outputs.release_created == 'true'
409409
runs-on: ubuntu-latest
410410

@@ -445,4 +445,4 @@ jobs:
445445
446446
env:
447447
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
448-
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
448+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)