Build & Publish Binaries #1088
This file contains 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: Build & Publish Binaries | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
schedule: | |
- cron: '0 13-21/2 * * *' # every 2 hours during US Eastern daytime | |
jobs: | |
typecheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.13.0 | |
- uses: pnpm/action-setup@v3 | |
name: Install pnpm | |
with: | |
version: 9.12.3 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build server | |
run: pnpm turbo typecheck --filter=@tunarr/server | |
- name: Build web | |
run: pnpm turbo typecheck --filter=@tunarr/web | |
build: | |
needs: typecheck | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 # Checkout code from repository | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.13.0 | |
- uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version-file: ".bun-version" | |
- uses: pnpm/action-setup@v3 | |
name: Install pnpm | |
with: | |
version: 9.12.3 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: 'Create env file (release)' | |
run: | | |
touch server/.env | |
echo TUNARR_EDGE_BUILD=false >> server/.env | |
echo NODE_ENV=production >> server/.env | |
echo TUNARR_BIND_ADDR=0.0.0.0 >> server/.env | |
cat server/.env | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: 'Create env file (edge)' | |
run: | | |
touch server/.env | |
echo TUNARR_BUILD="$(git rev-parse --short ${{ github.sha }})" >> server/.env | |
echo TUNARR_EDGE_BUILD=true >> server/.env | |
echo NODE_ENV=production >> server/.env | |
echo TUNARR_BIND_ADDR=0.0.0.0 >> server/.env | |
cat server/.env | |
if: github.ref == format('refs/heads/{0}', 'dev') && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') | |
- name: Bundle web | |
run: pnpm turbo bundle --filter=@tunarr/web | |
- name: Build Executable | |
run: pnpm turbo make-exec | |
- name: Upload Edge Binary | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: Tunarr Edge | |
tag_name: edge | |
prerelease: true | |
files: | | |
./server/dist/bin/tunarr-* | |
if: github.ref == format('refs/heads/{0}', 'dev') && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') | |
- name: Upload Binaries | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
./server/dist/bin/tunarr-* | |
if: startsWith(github.ref, 'refs/tags/') |