Puppeteer Dependency in builds

This commit is contained in:
Salastil
2025-11-23 04:02:39 -05:00
parent ff3bbb4dcf
commit 4f4c7b505e

View File

@@ -12,105 +12,83 @@ env:
BINARY_NAME: streamed-tui
jobs:
build:
release:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-go@v5
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: false
# Build raw binary
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
- name: Set up Node.js (required for Puppeteer bundling)
uses: actions/setup-node@v4
with:
node-version: "20"
#
# --- BUILD NODE MODULES (puppeteer-extra, stealth, puppeteer) ---
#
- name: Build bundled Node.js dependencies
run: |
mkdir -p dist
out="streamed-tui_${{ matrix.goos }}_${{ matrix.goarch }}"
go build -o "dist/${out}" .
chmod +x scripts/build_node_modules.sh
scripts/build_node_modules.sh
# Upload binary as an artifact
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: bin_${{ matrix.goos }}_${{ matrix.goarch }}
path: dist/streamed-tui_${{ matrix.goos }}_${{ matrix.goarch }}
source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Make source tarball
#
# --- BUILD LINUX AMD64 ---
#
- name: Build linux amd64
run: |
mkdir -p dist
tag="${GITHUB_REF_NAME}"
tar -czf "dist/${{ env.BINARY_NAME }}_${tag}_source.tar.gz" .
mkdir -p out
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build -o out/${BINARY_NAME}_linux_amd64 .
- name: Upload source artifact
uses: actions/upload-artifact@v4
with:
name: source
path: dist/*source.tar.gz
publish:
runs-on: ubuntu-latest
needs: [build, source]
permissions:
contents: write
steps:
# ❌ Delete all previous artifacts so old tar.gz does not pollute dist/
- name: Delete old workflow artifacts
uses: geekyeggo/delete-artifact@v4
with:
name: "*"
# Clean runner dist directory just in case
- name: Prepare clean dist folder
#
# --- BUILD LINUX ARM64 ---
#
- name: Build linux arm64
run: |
rm -rf dist
mkdir dist
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 \
go build -o out/${BINARY_NAME}_linux_arm64 .
# ⬇ Download only FRESH artifacts
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
#
# --- BUILD MACOS AMD64 ---
#
- name: Build darwin amd64
run: |
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 \
go build -o out/${BINARY_NAME}_darwin_amd64 .
# 🟢 Upload to GitHub Release
- name: Publish Release
#
# --- BUILD MACOS ARM64 ---
#
- name: Build darwin arm64
run: |
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 \
go build -o out/${BINARY_NAME}_darwin_arm64 .
#
# --- BUILD SOURCE TARBALL ---
#
- name: Create source tarball
run: |
mkdir -p release
git archive --format=tar.gz \
--output=release/${BINARY_NAME}_${{ github.ref_name }}_source.tar.gz HEAD
#
# --- UPLOAD RELEASE ASSETS ---
#
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
draft: false
prerelease: false
# Only publish what we want:
files: |
dist/streamed-tui_linux_amd64
dist/streamed-tui_linux_arm64
dist/streamed-tui_darwin_amd64
dist/streamed-tui_darwin_arm64
dist/streamed-tui_*_source.tar.gz
out/${{ env.BINARY_NAME }}_linux_amd64
out/${{ env.BINARY_NAME }}_linux_arm64
out/${{ env.BINARY_NAME }}_darwin_amd64
out/${{ env.BINARY_NAME }}_darwin_arm64
release/${{ env.BINARY_NAME }}_${{ github.ref_name }}_source.tar.gz