Skip to content

Commit 6c00311

Browse files
committed
chore: tag version v0.0.1
1 parent e6873a9 commit 6c00311

File tree

2 files changed

+24
-43
lines changed

2 files changed

+24
-43
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
tags:
66
- 'v[0-9]+.[0-9]+.[0-9]+'
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
release:
1013
runs-on: ubuntu-latest
@@ -87,7 +90,7 @@ jobs:
8790
echo "EOF" >> $GITHUB_OUTPUT
8891
8992
- name: Create GitHub Release
90-
uses: softprops/action-gh-release@v1
93+
uses: softprops/action-gh-release@v2
9194
with:
9295
files: bin/rules.zip
9396
body: ${{ steps.tag_message.outputs.message }}

docs/prompt-context/building-a-release-pipeline.md

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -224,37 +224,15 @@ jobs:
224224
run: bin/release.sh
225225

226226
- name: Create GitHub Release
227-
# Only create release if not already created (the tag push might not auto-create a release)
228-
id: create_release
229-
uses: actions/create-release@v1
230-
env:
231-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
227+
if: env.COMPILE_BINARY == 'true'
228+
uses: softprops/action-gh-release@v2
232229
with:
233-
tag_name: ${{ github.ref_name }} # vX.Y.Z
234-
release_name: ${{ github.ref_name }}
230+
files: bin/*
231+
tag_name: ${{ github.ref_name }}
232+
name: ${{ github.ref_name }}
235233
draft: false
236234
prerelease: false
237-
238-
- name: Upload assets (binaries and script)
239-
if: env.COMPILE_BINARY == 'true'
240-
uses: actions/upload-release-asset@v1
241-
env:
242-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
243-
with:
244-
upload_url: ${{ steps.create_release.outputs.upload_url }}
245-
asset_path: "./dist/*"
246-
asset_name: "${{ basename }}"
247-
248-
- name: Upload install script
249-
if: env.COMPILE_BINARY == 'true'
250-
uses: actions/upload-release-asset@v1
251-
env:
252-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
253-
with:
254-
upload_url: ${{ steps.create_release.outputs.upload_url }}
255-
asset_path: "./install.sh"
256-
asset_name: "install.sh"
257-
content_type: "application/x-sh"
235+
token: ${{ secrets.GITHUB_TOKEN }}
258236
```
259237
260238
**Explanation:** This workflow uses a single job for simplicity. It determines `RUNTIME` and `IS_CLI` via a bash step. Depending on `RUNTIME`, it sets up the appropriate environment and installs dependencies. It then calls `bin/publish.sh` and/or `bin/release.sh` to perform publishing and binary compilation. Finally, it creates a GitHub Release for the tag and uploads any release assets. (For library-only projects with no binaries, `bin/release.sh` will be skipped and the release will just be a tag with perhaps source code available.)
@@ -319,7 +297,7 @@ This script runs only for CLI tools that need standalone binaries (when `COMPILE
319297
set -e
320298

321299
# Ensure output directory
322-
mkdir -p dist
300+
mkdir -p bin
323301

324302
# Get package/tool name (for naming binaries)
325303
NAME=""
@@ -337,34 +315,34 @@ echo "Compiling binaries for $NAME..."
337315

338316
if [[ -f "deno.json" || -f "deno.jsonc" ]]; then
339317
# Deno cross-compilation for all targets:contentReference[oaicite:26]{index=26}
340-
deno compile -A --output dist/"$NAME-linux" --target x86_64-unknown-linux-gnu ${ENTRY:-main.ts}
341-
deno compile -A --output dist/"$NAME-macos" --target x86_64-apple-darwin ${ENTRY:-main.ts}
342-
deno compile -A --output dist/"$NAME-macos-arm64" --target aarch64-apple-darwin ${ENTRY:-main.ts}
343-
deno compile -A --output dist/"$NAME-windows.exe" --target x86_64-pc-windows-msvc ${ENTRY:-main.ts}
318+
deno compile -A --output bin/"$NAME-linux" --target x86_64-unknown-linux-gnu ${ENTRY:-main.ts}
319+
deno compile -A --output bin/"$NAME-macos" --target x86_64-apple-darwin ${ENTRY:-main.ts}
320+
deno compile -A --output bin/"$NAME-macos-arm64" --target aarch64-apple-darwin ${ENTRY:-main.ts}
321+
deno compile -A --output bin/"$NAME-windows.exe" --target x86_64-pc-windows-msvc ${ENTRY:-main.ts}
344322
elif [[ -f "bun.json" || -f "bun.lockb" ]]; then
345323
# Bun cross-compilation (x64 targets):contentReference[oaicite:27]{index=27}:contentReference[oaicite:28]{index=28}
346-
bun build --compile --target=bun-linux-x64 src/*.ts --outfile dist/"$NAME-linux"
347-
bun build --compile --target=bun-darwin-x64 src/*.ts --outfile dist/"$NAME-macos"
348-
bun build --compile --target=bun-windows-x64 src/*.ts --outfile dist/"$NAME-windows.exe"
324+
bun build --compile --target=bun-linux-x64 src/*.ts --outfile bin/"$NAME-linux"
325+
bun build --compile --target=bun-darwin-x64 src/*.ts --outfile bin/"$NAME-macos"
326+
bun build --compile --target=bun-windows-x64 src/*.ts --outfile bin/"$NAME-windows.exe"
349327
# Note: Bun will add .exe for Windows if not specified:contentReference[oaicite:29]{index=29}
350328
else
351329
# Node: use vercel/pkg to generate executables:contentReference[oaicite:30]{index=30}
352330
npm install -g pkg >/dev/null 2>&1 || npx pkg --help >/dev/null
353331
# Determine entry file: if package.json has a 'bin' script, use that; else use main
354332
ENTRY=$(node -p "require('./package.json').bin && typeof require('./package.json').bin==='object' ? Object.values(require('./package.json').bin)[0] : require('./package.json').main || 'index.js'")
355333
# Run pkg for Linux, macOS, Windows (x64). Adjust Node target version as needed.
356-
npx pkg -t node18-linux-x64,node18-macos-x64,node18-win-x64 "$ENTRY" --out-path dist/
334+
npx pkg -t node18-linux-x64,node18-macos-x64,node18-win-x64 "$ENTRY" --out-path bin/
357335
# pkg will produce files named like ${ENTRY}-<platform> (or the binary name if defined in package.json pkg config)
358336
# Rename outputs to our naming convention:
359-
[ -f dist/"$(basename $ENTRY)-linux" ] && mv dist/"$(basename $ENTRY)-linux" dist/"$NAME-linux"
360-
[ -f dist/"$(basename $ENTRY)-macos" ] && mv dist/"$(basename $ENTRY)-macos" dist/"$NAME-macos"
361-
[ -f dist/"$(basename $ENTRY).exe" ] && mv dist/"$(basename $ENTRY).exe" dist/"$NAME-windows.exe"
337+
[ -f bin/"$(basename $ENTRY)-linux" ] && mv bin/"$(basename $ENTRY)-linux" bin/"$NAME-linux"
338+
[ -f bin/"$(basename $ENTRY)-macos" ] && mv bin/"$(basename $ENTRY)-macos" bin/"$NAME-macos"
339+
[ -f bin/"$(basename $ENTRY).exe" ] && mv bin/"$(basename $ENTRY).exe" bin/"$NAME-windows.exe"
362340
fi
363341

364342
# (Optional) compress the binaries for smaller download (not done here for simplicity)
365343

366344
echo "Binaries compiled. Verifying files:"
367-
ls -lh dist/
345+
ls -lh bin/
368346

369347
# Prepare install.sh (in repo root) if not present
370348
if [ ! -f "install.sh" ]; then
@@ -422,7 +400,7 @@ A few points about `bin/release.sh`:
422400
* Makes the binary executable and prints a success message.
423401
* For Windows, since this is a Bash script, it would typically be run in WSL or Git Bash. Windows users not using a UNIX shell can manually download the `.exe` or use a PowerShell equivalent script (not included here).
424402

425-
After running `bin/release.sh`, the `dist/` folder contains our compiled binaries named `${NAME}-linux`, `${NAME}-macos`, `${NAME}-macos-arm64` (if Deno), and `${NAME}-windows.exe`. The workflow then attaches everything in `dist/` as well as the `install.sh` to the GitHub Release. Users can now go to the release page and download the binaries, or simply run the one-liner install command:
403+
After running `bin/release.sh`, the `bin/` folder contains our compiled binaries named `${NAME}-linux`, `${NAME}-macos`, `${NAME}-macos-arm64` (if Deno), and `${NAME}-windows.exe`. The workflow then attaches everything in `bin/` as well as the `install.sh` to the GitHub Release. Users can now go to the release page and download the binaries, or simply run the one-liner install command:
426404

427405
```bash
428406
# Example usage for a tool named "mytool"

0 commit comments

Comments
 (0)