Skip to content

1.1.28

1.1.28 #30

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
name: byebyecode-linux-x64.tar.gz
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
name: byebyecode-linux-x64-static.tar.gz
- target: x86_64-pc-windows-gnu
os: ubuntu-latest
name: byebyecode-windows-x64.zip
- target: x86_64-apple-darwin
os: macos-latest
name: byebyecode-macos-x64.tar.gz
- target: aarch64-apple-darwin
os: macos-latest
name: byebyecode-macos-arm64.tar.gz
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'x86_64-pc-windows-gnu'
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64 pkg-config libssl-dev
- name: Install musl tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools pkg-config libssl-dev
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package Linux/macOS
if: matrix.os != 'windows-latest' && matrix.target != 'x86_64-pc-windows-gnu'
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/byebyecode dist/byebyecode
cd dist
tar czf ../${{ matrix.name }} byebyecode
- name: Package Windows
if: matrix.target == 'x86_64-pc-windows-gnu'
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/byebyecode.exe dist/byebyecode.exe
cd dist
zip ../${{ matrix.name }} byebyecode.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}
release:
name: Create Release
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*/*
generate_release_notes: true
draft: false
prerelease: false
- name: Setup Node.js for NPM
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Extract binaries from archives
run: |
mkdir -p extracted
# macOS x64
tar -xzf artifacts/byebyecode-macos-x64.tar.gz/byebyecode-macos-x64.tar.gz -C extracted
mv extracted/byebyecode extracted/byebyecode-darwin-x64
# macOS ARM64
tar -xzf artifacts/byebyecode-macos-arm64.tar.gz/byebyecode-macos-arm64.tar.gz -C extracted
mv extracted/byebyecode extracted/byebyecode-darwin-arm64
# Linux x64
tar -xzf artifacts/byebyecode-linux-x64.tar.gz/byebyecode-linux-x64.tar.gz -C extracted
mv extracted/byebyecode extracted/byebyecode-linux-x64
# Linux musl (static)
tar -xzf artifacts/byebyecode-linux-x64-static.tar.gz/byebyecode-linux-x64-static.tar.gz -C extracted
mv extracted/byebyecode extracted/byebyecode-linux-x64-musl
# Windows
unzip artifacts/byebyecode-windows-x64.zip/byebyecode-windows-x64.zip -d extracted
mv extracted/byebyecode.exe extracted/byebyecode-win32-x64.exe
# List extracted files
ls -la extracted/
- name: Prepare NPM packages
run: |
# Prepare packages with version management
node npm/scripts/prepare-packages.js
# Copy binaries to platform directories
cp extracted/byebyecode-darwin-x64 npm-publish/darwin-x64/byebyecode
cp extracted/byebyecode-darwin-arm64 npm-publish/darwin-arm64/byebyecode
cp extracted/byebyecode-linux-x64 npm-publish/linux-x64/byebyecode
cp extracted/byebyecode-linux-x64-musl npm-publish/linux-x64-musl/byebyecode
cp extracted/byebyecode-win32-x64.exe npm-publish/win32-x64/byebyecode.exe
# Set executable permissions for Unix binaries
chmod +x npm-publish/darwin-x64/byebyecode
chmod +x npm-publish/darwin-arm64/byebyecode
chmod +x npm-publish/linux-x64/byebyecode
chmod +x npm-publish/linux-x64-musl/byebyecode
# Verify packages
echo "Package structure:"
find npm-publish -name "package.json" -exec echo "=== {} ===" \; -exec head -5 {} \;
- name: Publish platform packages to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# Publish platform packages first
for platform in darwin-x64 darwin-arm64 linux-x64 linux-x64-musl win32-x64; do
echo "📦 发布 @88code/byebyecode-$platform"
cd npm-publish/$platform
npm publish --access public
cd ../..
echo "✅ 完成 @88code/byebyecode-$platform"
done
- name: Wait for NPM registry
run: |
echo "⏳ Waiting for platform packages to be available on NPM..."
sleep 30
- name: Publish main package to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd npm-publish/main
echo "📦 发布 @88code/byebyecode"
npm publish --access public
echo "✅ 完成 @88code/byebyecode"
echo ""
echo "🎉 NPM packages published successfully!"
echo "Install with: npm install -g @88code/byebyecode"