Retries and color coded progress bar (#71) #94
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" # Run when tag is pushed matching pattern v*, e.g., v1.0.0 | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version number (without v prefix, e.g., 1.0.0)" | |
| required: true | |
| type: string | |
| draft: | |
| description: "Create as draft release" | |
| required: false | |
| type: boolean | |
| default: false | |
| replace_release: | |
| description: "Replace existing release if present" | |
| required: false | |
| type: boolean | |
| default: false | |
| jobs: | |
| build-linux: | |
| name: Build Linux Binary | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Deno | |
| uses: denoland/setup-deno@v1 | |
| with: | |
| deno-version: v2.x | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| RAW_VERSION="${{ github.event.inputs.version }}" | |
| else | |
| RAW_VERSION="${GITHUB_REF#refs/tags/}" | |
| fi | |
| # JSR requires normalized semver (no leading v) | |
| NORMALIZED_VERSION="${RAW_VERSION#v}" | |
| echo "VERSION=${NORMALIZED_VERSION}" >> $GITHUB_ENV | |
| - name: Sync version files for build | |
| run: deno run --allow-read --allow-write scripts/sync-version.ts "${{ env.VERSION }}" | |
| - name: Build Linux binary | |
| run: | | |
| mkdir -p dist | |
| deno compile \ | |
| --no-check \ | |
| --allow-run \ | |
| --allow-read \ | |
| --allow-write \ | |
| --allow-net \ | |
| --allow-env \ | |
| --allow-sys \ | |
| --target x86_64-unknown-linux-gnu \ | |
| --output dist/nsyte-linux \ | |
| src/cli.ts | |
| - name: Create compressed version | |
| run: | | |
| cp dist/nsyte-linux dist/nsyte-linux-compressed | |
| - name: Compress with UPX | |
| uses: svenstaro/upx-action@v2 | |
| with: | |
| files: dist/nsyte-linux-compressed | |
| args: --best --lzma | |
| strip: false | |
| - name: Rename binaries | |
| run: | | |
| cd dist | |
| cp nsyte-linux nsyte-linux-${{ env.VERSION }} | |
| mv nsyte-linux-compressed nsyte-linux-compressed-${{ env.VERSION }} | |
| - name: Display sizes | |
| run: | | |
| echo "Linux binary sizes:" | |
| ls -lh dist/nsyte-linux* | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-binaries | |
| path: | | |
| dist/nsyte-linux | |
| dist/nsyte-linux-${{ env.VERSION }} | |
| dist/nsyte-linux-compressed-${{ env.VERSION }} | |
| build-macos-intel: | |
| name: Build macOS Intel Binary | |
| runs-on: macos-15-intel | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Deno | |
| uses: denoland/setup-deno@v1 | |
| with: | |
| deno-version: v2.x | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| RAW_VERSION="${{ github.event.inputs.version }}" | |
| else | |
| RAW_VERSION="${GITHUB_REF#refs/tags/}" | |
| fi | |
| NORMALIZED_VERSION="${RAW_VERSION#v}" | |
| echo "VERSION=${NORMALIZED_VERSION}" >> $GITHUB_ENV | |
| - name: Sync version files for build | |
| run: deno run --allow-read --allow-write scripts/sync-version.ts "${{ env.VERSION }}" | |
| - name: Build macOS Intel binary | |
| run: | | |
| mkdir -p dist | |
| deno compile \ | |
| --no-check \ | |
| --allow-run \ | |
| --allow-read \ | |
| --allow-write \ | |
| --allow-net \ | |
| --allow-env \ | |
| --allow-sys \ | |
| --target x86_64-apple-darwin \ | |
| --output dist/nsyte-macos-x64 \ | |
| src/cli.ts | |
| - name: Install UPX | |
| run: | | |
| brew install upx | |
| - name: Create compressed version | |
| run: | | |
| cp dist/nsyte-macos-x64 dist/nsyte-macos-x64-compressed | |
| upx --best --lzma --force-macos dist/nsyte-macos-x64-compressed | |
| - name: Rename binaries | |
| run: | | |
| cd dist | |
| cp nsyte-macos-x64 nsyte-macos-x64-${{ env.VERSION }} | |
| mv nsyte-macos-x64-compressed nsyte-macos-x64-compressed-${{ env.VERSION }} | |
| - name: Display sizes | |
| run: | | |
| echo "macOS Intel binary sizes:" | |
| ls -lh dist/nsyte-macos-x64* | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-intel-binaries | |
| path: | | |
| dist/nsyte-macos-x64 | |
| dist/nsyte-macos-x64-${{ env.VERSION }} | |
| dist/nsyte-macos-x64-compressed-${{ env.VERSION }} | |
| build-macos-arm: | |
| name: Build macOS Apple Silicon Binary | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Deno | |
| uses: denoland/setup-deno@v1 | |
| with: | |
| deno-version: v2.x | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| RAW_VERSION="${{ github.event.inputs.version }}" | |
| else | |
| RAW_VERSION="${GITHUB_REF#refs/tags/}" | |
| fi | |
| NORMALIZED_VERSION="${RAW_VERSION#v}" | |
| echo "VERSION=${NORMALIZED_VERSION}" >> $GITHUB_ENV | |
| - name: Sync version files for build | |
| run: deno run --allow-read --allow-write scripts/sync-version.ts "${{ env.VERSION }}" | |
| - name: Build macOS Apple Silicon binary | |
| run: | | |
| mkdir -p dist | |
| deno compile \ | |
| --no-check \ | |
| --allow-run \ | |
| --allow-read \ | |
| --allow-write \ | |
| --allow-net \ | |
| --allow-env \ | |
| --allow-sys \ | |
| --target aarch64-apple-darwin \ | |
| --output dist/nsyte-macos-arm64 \ | |
| src/cli.ts | |
| - name: Install UPX | |
| run: | | |
| brew install upx | |
| - name: Create compressed version | |
| run: | | |
| cp dist/nsyte-macos-arm64 dist/nsyte-macos-arm64-compressed | |
| if ! upx --best --lzma --force-macos dist/nsyte-macos-arm64-compressed; then | |
| echo "UPX compression failed on arm64; shipping uncompressed copy as the compressed artifact." | |
| cp dist/nsyte-macos-arm64 dist/nsyte-macos-arm64-compressed | |
| fi | |
| - name: Rename binaries | |
| run: | | |
| cd dist | |
| cp nsyte-macos-arm64 nsyte-macos-arm64-${{ env.VERSION }} | |
| mv nsyte-macos-arm64-compressed nsyte-macos-arm64-compressed-${{ env.VERSION }} | |
| - name: Display sizes | |
| run: | | |
| echo "macOS Apple Silicon binary sizes:" | |
| ls -lh dist/nsyte-macos-arm64* | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-arm-binaries | |
| path: | | |
| dist/nsyte-macos-arm64 | |
| dist/nsyte-macos-arm64-${{ env.VERSION }} | |
| dist/nsyte-macos-arm64-compressed-${{ env.VERSION }} | |
| build-windows: | |
| name: Build Windows Binary | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Deno | |
| uses: denoland/setup-deno@v1 | |
| with: | |
| deno-version: v2.x | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| if ("${{ github.event_name }}" -eq "workflow_dispatch") { | |
| $RAW_VERSION = "${{ github.event.inputs.version }}" | |
| } else { | |
| $RAW_VERSION = "$($env:GITHUB_REF -replace 'refs/tags/', '')" | |
| } | |
| $NORMALIZED_VERSION = $RAW_VERSION -replace '^v', '' | |
| echo "VERSION=$NORMALIZED_VERSION" >> $env:GITHUB_ENV | |
| shell: pwsh | |
| - name: Sync version files for build | |
| run: deno run --allow-read --allow-write scripts/sync-version.ts "${{ env.VERSION }}" | |
| shell: pwsh | |
| - name: Build Windows binary | |
| run: | | |
| mkdir -Force dist | |
| deno compile ` | |
| --no-check ` | |
| --no-terminal ` | |
| --allow-run ` | |
| --allow-read ` | |
| --allow-write ` | |
| --allow-net ` | |
| --allow-env ` | |
| --allow-sys ` | |
| --target x86_64-pc-windows-msvc ` | |
| --output dist/nsyte-windows.exe ` | |
| src/cli.ts | |
| shell: pwsh | |
| - name: Create compressed version | |
| run: | | |
| Copy-Item dist/nsyte-windows.exe dist/nsyte-windows-compressed.exe | |
| shell: pwsh | |
| - name: Compress with UPX | |
| uses: svenstaro/upx-action@v2 | |
| with: | |
| files: dist/nsyte-windows-compressed.exe | |
| args: --best --lzma | |
| strip: false | |
| - name: Rename binaries | |
| run: | | |
| cd dist | |
| Copy-Item nsyte-windows.exe "nsyte-windows-${{ env.VERSION }}.exe" | |
| Move-Item nsyte-windows-compressed.exe "nsyte-windows-compressed-${{ env.VERSION }}.exe" | |
| shell: pwsh | |
| - name: Display sizes | |
| run: | | |
| echo "Windows binary sizes:" | |
| Get-ChildItem dist/nsyte-windows* | Select-Object Name, @{Name="Size";Expression={"{0:N2} MB" -f ($_.Length / 1MB)}} | |
| shell: pwsh | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-binaries | |
| path: | | |
| dist/nsyte-windows.exe | |
| dist/nsyte-windows-${{ env.VERSION }}.exe | |
| dist/nsyte-windows-compressed-${{ env.VERSION }}.exe | |
| publish-jsr: | |
| name: Publish to JSR | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # Required for OIDC authentication with JSR | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Deno | |
| uses: denoland/setup-deno@v1 | |
| with: | |
| deno-version: v2.x | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| RAW_VERSION="${{ github.event.inputs.version }}" | |
| else | |
| RAW_VERSION="${GITHUB_REF#refs/tags/}" | |
| fi | |
| # JSR requires normalized semver (no leading v) | |
| NORMALIZED_VERSION="${RAW_VERSION#v}" | |
| echo "VERSION=${NORMALIZED_VERSION}" >> $GITHUB_ENV | |
| - name: Sync version files for publish | |
| run: deno run --allow-read --allow-write scripts/sync-version.ts "${{ env.VERSION }}" | |
| - name: Check JSR publish (dry run) | |
| run: | | |
| echo "Running JSR publish dry run to check for issues..." | |
| deno publish --dry-run --allow-dirty | |
| if [ $? -ne 0 ]; then | |
| echo "::error::JSR publish dry run failed. Please fix the issues before releasing." | |
| exit 1 | |
| fi | |
| echo "✅ JSR publish dry run successful" | |
| - name: Publish to JSR | |
| run: deno publish --allow-dirty | |
| release: | |
| name: Create Release | |
| needs: [build-linux, build-macos-intel, build-macos-arm, build-windows, publish-jsr] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| RAW_VERSION="${{ github.event.inputs.version }}" | |
| else | |
| RAW_VERSION="${GITHUB_REF#refs/tags/}" | |
| fi | |
| NORMALIZED_VERSION="${RAW_VERSION#v}" | |
| echo "VERSION=${NORMALIZED_VERSION}" >> $GITHUB_ENV | |
| - name: Remove existing release if requested | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.replace_release == 'true' }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| TAG_NAME="v${{ env.VERSION }}" | |
| else | |
| TAG_NAME="${GITHUB_REF#refs/tags/}" | |
| fi | |
| if gh release view "$TAG_NAME" >/dev/null 2>&1; then | |
| echo "Deleting existing release $TAG_NAME..." | |
| gh release delete "$TAG_NAME" -y | |
| else | |
| echo "No existing release found for $TAG_NAME" | |
| fi | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Prepare release files | |
| run: | | |
| mkdir -p release | |
| cp artifacts/linux-binaries/* release/ | |
| cp artifacts/macos-intel-binaries/* release/ | |
| cp artifacts/macos-arm-binaries/* release/ | |
| cp artifacts/windows-binaries/* release/ | |
| ls -la release/ | |
| - name: Create size report | |
| run: | | |
| cat > release/size-report.md << EOF | |
| # Binary Size Report for v${{ env.VERSION }} | |
| ## Standard Binaries | |
| - Linux: $(ls -lh release/nsyte-linux 2>/dev/null | awk '{print $5}' || echo "N/A") | |
| - macOS (Intel): $(ls -lh release/nsyte-macos-x64 2>/dev/null | awk '{print $5}' || echo "N/A") | |
| - macOS (Apple Silicon): $(ls -lh release/nsyte-macos-arm64 2>/dev/null | awk '{print $5}' || echo "N/A") | |
| - Windows: $(ls -lh release/nsyte-windows.exe 2>/dev/null | awk '{print $5}' || echo "N/A") | |
| ## Compressed Binaries (UPX --best --lzma) | |
| - Linux: $(ls -lh release/nsyte-linux-compressed-${{ env.VERSION }} 2>/dev/null | awk '{print $5}' || echo "N/A") | |
| - macOS (Intel): $(ls -lh release/nsyte-macos-x64-compressed-${{ env.VERSION }} 2>/dev/null | awk '{print $5}' || echo "N/A") | |
| - macOS (Apple Silicon): $(ls -lh release/nsyte-macos-arm64-compressed-${{ env.VERSION }} 2>/dev/null | awk '{print $5}' || echo "N/A") | |
| - Windows: $(ls -lh release/nsyte-windows-compressed-${{ env.VERSION }}.exe 2>/dev/null | awk '{print $5}' || echo "N/A") | |
| ## Compression Savings | |
| Compressed binaries typically save 60-70% of the original size. | |
| EOF | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', env.VERSION) || github.ref_name }} | |
| name: nsyte v${{ env.VERSION }} | |
| draft: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.draft == 'true' || false }} | |
| prerelease: false | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| body: | | |
| ## nsyte v${{ env.VERSION }} | |
| ### What's New | |
| - See the [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details | |
| ### Download Options | |
| We provide both **standard** and **compressed** binaries: | |
| - **Standard**: Original binaries (~88MB) - recommended for most users | |
| - **Compressed**: UPX-compressed binaries (~30MB) - smaller download, slightly slower startup | |
| ### Installation | |
| #### Install from JSR (Recommended) | |
| ```bash | |
| # Using Deno | |
| deno install -Agr jsr:@nsyte/cli | |
| # Using npm (requires Node.js) | |
| npx jsr add -g @nsyte/cli | |
| # Using other package managers | |
| # See https://jsr.io/@nsyte/cli for more options | |
| ``` | |
| #### macOS (Apple Silicon) | |
| ```bash | |
| # Download and make executable | |
| curl -L https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }}/nsyte-macos-arm64-${{ env.VERSION }} -o nsyte | |
| chmod +x nsyte | |
| sudo mv nsyte /usr/local/bin/ | |
| # Or compressed version (smaller download) | |
| curl -L https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }}/nsyte-macos-arm64-compressed-${{ env.VERSION }} -o nsyte | |
| chmod +x nsyte | |
| sudo mv nsyte /usr/local/bin/ | |
| ``` | |
| #### macOS (Intel / Rosetta) | |
| ```bash | |
| # Download and make executable | |
| curl -L https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }}/nsyte-macos-x64-${{ env.VERSION }} -o nsyte | |
| chmod +x nsyte | |
| sudo mv nsyte /usr/local/bin/ | |
| # Or compressed version (smaller download) | |
| curl -L https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }}/nsyte-macos-x64-compressed-${{ env.VERSION }} -o nsyte | |
| chmod +x nsyte | |
| sudo mv nsyte /usr/local/bin/ | |
| ``` | |
| #### Linux | |
| ```bash | |
| # Download and make executable | |
| curl -L https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }}/nsyte-linux-${{ env.VERSION }} -o nsyte | |
| chmod +x nsyte | |
| sudo mv nsyte /usr/local/bin/ | |
| # Or compressed version (smaller download) | |
| curl -L https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }}/nsyte-linux-compressed-${{ env.VERSION }} -o nsyte | |
| chmod +x nsyte | |
| sudo mv nsyte /usr/local/bin/ | |
| ``` | |
| #### Windows | |
| Download the executable and add it to your PATH: | |
| - Standard: `nsyte-windows-${{ env.VERSION }}.exe` | |
| - Compressed: `nsyte-windows-compressed-${{ env.VERSION }}.exe` | |
| ### Quick Start | |
| ```bash | |
| # Initialize a new nsyte project | |
| nsyte init | |
| # Deploy your site | |
| nsyte deploy ./my-site | |
| # List deployed files | |
| nsyte ls | |
| ``` | |
| ### ⚠️ Note on Compressed Binaries | |
| Compressed binaries use UPX compression and may: | |
| - Take 1-2 seconds longer to start (decompression overhead) | |
| - Trigger antivirus warnings on Windows (false positives) | |
| - Not work with macOS Gatekeeper without additional steps | |
| **If you experience any issues, please use the standard binaries.** | |
| files: | | |
| release/nsyte-linux | |
| release/nsyte-macos-x64 | |
| release/nsyte-macos-arm64 | |
| release/nsyte-windows.exe | |
| release/nsyte-linux-${{ env.VERSION }} | |
| release/nsyte-macos-x64-${{ env.VERSION }} | |
| release/nsyte-macos-arm64-${{ env.VERSION }} | |
| release/nsyte-windows-${{ env.VERSION }}.exe | |
| release/nsyte-linux-compressed-${{ env.VERSION }} | |
| release/nsyte-macos-x64-compressed-${{ env.VERSION }} | |
| release/nsyte-macos-arm64-compressed-${{ env.VERSION }} | |
| release/nsyte-windows-compressed-${{ env.VERSION }}.exe | |
| release/size-report.md | |
| fail_on_unmatched_files: false |