docs(README): update project name and installation instructions #1
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: Release multi-platform executables | |
| on: | |
| push: | |
| tags: ['v*.*.*'] | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| build: | |
| name: build-${{ matrix.target }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: bun-linux-x64 | |
| - os: ubuntu-latest | |
| target: bun-linux-arm64 | |
| - os: macos-latest | |
| target: bun-darwin-x64 | |
| - os: macos-latest | |
| target: bun-darwin-arm64 | |
| - os: windows-latest | |
| target: bun-windows-x64 | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| BIN: backlog-bin${{ contains(matrix.target,'windows') && '.exe' || '' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v1 | |
| - uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-${{ matrix.target }}-bun-${{ hashFiles('**/bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}-bun- | |
| - run: bun install --frozen-lockfile | |
| - name: Sync version to tag | |
| shell: bash | |
| run: | | |
| TAG="${GITHUB_REF##refs/tags/v}" | |
| jq ".version = \"$TAG\"" package.json > tmp.json && mv tmp.json package.json | |
| - name: Compile standalone binary | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| bun build src/cli.ts --compile --minify --target=${{ matrix.target }} --define __EMBEDDED_VERSION__="\"${GITHUB_REF##refs/tags/v}\"" --outfile=dist/${{ env.BIN }} | |
| - name: Make binary executable (non-Windows) | |
| if: ${{ !contains(matrix.target,'windows') }} | |
| run: chmod +x "dist/${{ env.BIN }}" | |
| - name: Check build output and move binary | |
| shell: bash | |
| run: | | |
| echo "Contents of dist/:" | |
| ls -la dist/ | |
| echo "Moving dist/${{ env.BIN }} to ${{ env.BIN }}" | |
| mv dist/${{ env.BIN }} ${{ env.BIN }} | |
| echo "Final binary size:" | |
| ls -lh ${{ env.BIN }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: backlog-${{ matrix.target }} | |
| path: ${{ env.BIN }} | |
| npm-publish: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Prepare npm package | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| cp scripts/cli.cjs dist/cli.js | |
| cp scripts/resolveBinary.cjs dist/resolveBinary.cjs | |
| cp scripts/postuninstall.cjs dist/postuninstall.cjs | |
| chmod +x dist/cli.js | |
| - name: Create npm-ready package.json | |
| shell: bash | |
| run: | | |
| TAG="${GITHUB_REF##refs/tags/v}" | |
| jq 'del(.devDependencies,.scripts.prepare,.scripts.preinstall,.type) | | |
| .version = "'$TAG'" | | |
| .bin = {backlog:"cli.js"} | | |
| .files = ["cli.js","resolveBinary.cjs","postuninstall.cjs","package.json","README.md","LICENSE"] | | |
| .scripts = {"postuninstall": "node postuninstall.cjs"} | | |
| .optionalDependencies = { | |
| "backlog.md-linux-x64" : "'$TAG'", | |
| "backlog.md-linux-arm64": "'$TAG'", | |
| "backlog.md-darwin-x64" : "'$TAG'", | |
| "backlog.md-darwin-arm64": "'$TAG'", | |
| "backlog.md-windows-x64": "'$TAG'" | |
| }' package.json > dist/package.json | |
| cp LICENSE README.md dist/ 2>/dev/null || true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| - name: Publish to npm | |
| run: | | |
| cd dist | |
| npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
| publish-binaries: | |
| needs: [build, npm-publish] | |
| strategy: | |
| matrix: | |
| include: | |
| - target: bun-linux-x64 | |
| package: backlog.md-linux-x64 | |
| os: linux | |
| cpu: x64 | |
| - target: bun-linux-arm64 | |
| package: backlog.md-linux-arm64 | |
| os: linux | |
| cpu: arm64 | |
| - target: bun-darwin-x64 | |
| package: backlog.md-darwin-x64 | |
| os: darwin | |
| cpu: x64 | |
| - target: bun-darwin-arm64 | |
| package: backlog.md-darwin-arm64 | |
| os: darwin | |
| cpu: arm64 | |
| - target: bun-windows-x64 | |
| package: backlog.md-windows-x64 | |
| os: win32 | |
| cpu: x64 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: backlog-${{ matrix.target }} | |
| timeout-minutes: 15 | |
| - name: Prepare package | |
| shell: bash | |
| run: | | |
| TAG="${GITHUB_REF##refs/tags/v}" | |
| mkdir -p pkg | |
| # Rename the binary to the expected name | |
| if [[ -f backlog-bin.exe ]]; then | |
| mv backlog-bin.exe pkg/backlog.exe | |
| elif [[ -f backlog-bin ]]; then | |
| mv backlog-bin pkg/backlog | |
| else | |
| echo "Error: No binary found" | |
| ls -la | |
| exit 1 | |
| fi | |
| cp LICENSE README.md pkg/ 2>/dev/null || true | |
| cat <<EOF > pkg/package.json | |
| { | |
| "name": "${{ matrix.package }}", | |
| "version": "${TAG}", | |
| "os": ["${{ matrix.os }}"], | |
| "cpu": ["${{ matrix.cpu }}"], | |
| "bin": {"backlog": "backlog${{ contains(matrix.target,'windows') && '.exe' || '' }}"}, | |
| "files": ["backlog${{ contains(matrix.target,'windows') && '.exe' || '' }}","package.json","LICENSE"] | |
| } | |
| EOF | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| - name: Publish platform package | |
| run: | | |
| cd pkg | |
| npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
| github-release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: release-assets | |
| timeout-minutes: 15 | |
| - name: Rename binaries for release | |
| run: | | |
| echo "=== Debug: Downloaded artifacts ===" | |
| find release-assets -type f -exec ls -lh {} \; | |
| echo "=== Processing artifacts ===" | |
| mkdir -p binaries | |
| for dir in release-assets/*/; do | |
| if [ -d "$dir" ]; then | |
| target=$(basename "$dir" | sed 's/backlog-//') | |
| echo "Processing target: $target" | |
| echo "Directory contents:" | |
| ls -la "$dir" | |
| binary=$(find "$dir" -name "backlog-bin*" -type f) | |
| if [ -n "$binary" ]; then | |
| echo "Found binary: $binary ($(ls -lh "$binary" | awk '{print $5}'))" | |
| if [[ "$target" == *"windows"* ]] && [[ "$binary" == *".exe" ]]; then | |
| cp "$binary" "binaries/backlog-${target}.exe" | |
| echo "Copied to binaries/backlog-${target}.exe ($(ls -lh "binaries/backlog-${target}.exe" | awk '{print $5}'))" | |
| else | |
| cp "$binary" "binaries/backlog-${target}" | |
| echo "Copied to binaries/backlog-${target} ($(ls -lh "binaries/backlog-${target}" | awk '{print $5}'))" | |
| fi | |
| fi | |
| fi | |
| done | |
| echo "=== Final binaries ===" | |
| ls -lh binaries/ | |
| - uses: softprops/action-gh-release@v1 | |
| with: | |
| files: binaries/* |