Initial commit
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
8401fdaf91
15 files changed
+10742
No files matched your search
@@ -0,0 +1,59 @@
|
||||
name: Build and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Install build toolchain
|
||||
run: |
|
||||
if command -v apt-get >/dev/null; then
|
||||
SUDO=$(command -v sudo || true)
|
||||
$SUDO apt-get update -y
|
||||
$SUDO apt-get install -y build-essential python3
|
||||
fi
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
pnpm run build --if-present
|
||||
# Compile the native addon if the build script did not already do so
|
||||
[ -d build/Release ] || pnpm exec node-gyp rebuild
|
||||
|
||||
- name: Package binary
|
||||
run: |
|
||||
NAME=unplayplay-${GITHUB_REF_NAME:-dev}-linux-x64
|
||||
mkdir -p dist-release
|
||||
tar -czf "dist-release/${NAME}.tar.gz" build/Release/*.node
|
||||
ls -la dist-release
|
||||
|
||||
- name: Create release and upload assets
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
run: |
|
||||
API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
||||
TAG="${GITHUB_REF_NAME}"
|
||||
RELEASE_ID=$(curl -sf -X POST "$API/releases" \
|
||||
-H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\"}" | sed -n 's/.*"id":\([0-9]*\).*/\1/p' | head -1)
|
||||
for f in dist-release/*; do
|
||||
curl -sf -X POST "$API/releases/${RELEASE_ID}/assets?name=$(basename "$f")" \
|
||||
-H "Authorization: token ${TOKEN}" -F "attachment=@${f}"
|
||||
done
|
||||
Reference in new issue
Block a user