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 BINARY_NAME: streamed-tui
jobs: jobs:
release:
build:
runs-on: ubuntu-latest 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: 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: with:
go-version-file: go.mod go-version-file: go.mod
cache: false
# Build raw binary - name: Set up Node.js (required for Puppeteer bundling)
- name: Build binary uses: actions/setup-node@v4
env: with:
GOOS: ${{ matrix.goos }} node-version: "20"
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0 #
# --- BUILD NODE MODULES (puppeteer-extra, stealth, puppeteer) ---
#
- name: Build bundled Node.js dependencies
run: | run: |
mkdir -p dist chmod +x scripts/build_node_modules.sh
out="streamed-tui_${{ matrix.goos }}_${{ matrix.goarch }}" scripts/build_node_modules.sh
go build -o "dist/${out}" .
# Upload binary as an artifact #
- name: Upload binary artifact # --- BUILD LINUX AMD64 ---
uses: actions/upload-artifact@v4 #
with: - name: Build linux amd64
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
run: | run: |
mkdir -p dist mkdir -p out
tag="${GITHUB_REF_NAME}" GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
tar -czf "dist/${{ env.BINARY_NAME }}_${tag}_source.tar.gz" . go build -o out/${BINARY_NAME}_linux_amd64 .
- name: Upload source artifact #
uses: actions/upload-artifact@v4 # --- BUILD LINUX ARM64 ---
with: #
name: source - name: Build linux arm64
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
run: | run: |
rm -rf dist GOOS=linux GOARCH=arm64 CGO_ENABLED=0 \
mkdir dist go build -o out/${BINARY_NAME}_linux_arm64 .
# ⬇ Download only FRESH artifacts #
- name: Download artifacts # --- BUILD MACOS AMD64 ---
uses: actions/download-artifact@v4 #
with: - name: Build darwin amd64
path: dist run: |
merge-multiple: true 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 uses: softprops/action-gh-release@v2
with: with:
tag_name: ${{ github.ref_name }}
draft: false
prerelease: false
# Only publish what we want:
files: | files: |
dist/streamed-tui_linux_amd64 out/${{ env.BINARY_NAME }}_linux_amd64
dist/streamed-tui_linux_arm64 out/${{ env.BINARY_NAME }}_linux_arm64
dist/streamed-tui_darwin_amd64 out/${{ env.BINARY_NAME }}_darwin_amd64
dist/streamed-tui_darwin_arm64 out/${{ env.BINARY_NAME }}_darwin_arm64
dist/streamed-tui_*_source.tar.gz release/${{ env.BINARY_NAME }}_${{ github.ref_name }}_source.tar.gz