You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

127 lines
3.7 KiB

name: Release
on:
release:
types: [released, prereleased]
permissions:
id-token: write
contents: write
packages: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# --- Checkout Code ---
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
# --- Setup Bun ---
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
# --- Setup Deno ---
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
# --- Cache Bun Dependencies ---
- name: Cache Bun Dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
packages/web/node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
# --- Cache Deno Dependencies ---
- name: Cache Deno Dependencies
uses: actions/cache@v4
with:
path: ~/.cache/deno
key: ${{ runner.os }}-deno-${{ hashFiles('**/deno.lock') }}
restore-keys: |
${{ runner.os }}-deno-
# --- Build All Packages ---
- name: Build All Packages
run: |
set -euo pipefail
for pkg_dir in packages/*/; do
pkg_dir=${pkg_dir%/} # Remove trailing slash
echo "🔍 Inspecting $pkg_dir"
# Skip web package and transport-deno
if [[ "$pkg_dir" == "packages/web" ]] || [[ "$pkg_dir" == "packages/transport-deno" ]]; then
echo "⏭️ Skipping $pkg_dir package"
continue
fi
# Build npm package for all other packages
if [[ -f "$pkg_dir/package.json" ]]; then
echo "📦 Building npm package: $pkg_dir"
(cd "$pkg_dir" && pnpm install && pnpm run build:npm)
echo "📦 Package built successfully: $pkg_dir"
else
echo "❓ No package.json found in $pkg_dir — skipping"
fi
done
# --- Web Package Specific Tasks ---
- name: Run Web App Tests
working-directory: packages/web
run: pnpm run test
- name: Create Web App Release Archive
working-directory: packages/web
run: pnpm run package
- name: Upload Web App Archive
uses: actions/upload-artifact@v4
with:
name: web-build
if-no-files-found: error
path: packages/web/dist/build.tar
- name: Attach Web Archive to GitHub Release
run: gh release upload ${{ github.event.release.tag_name }} packages/web/dist/build.tar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# --- Build & Push Container Image ---
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build Container Image
id: build-container
uses: redhat-actions/buildah-build@v2
with:
containerfiles: |
./infra/Containerfile
image: ghcr.io/${{ github.repository }}
tags: latest, ${{ github.event.release.tag_name }}
oci: true
platforms: linux/amd64, linux/arm64
- name: Push Container to GHCR
id: push-to-registry
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-container.outputs.image }}
tags: ${{ steps.build-container.outputs.tags }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Output Image URL
run: echo "🖼️ Image pushed to ${{ steps.push-to-registry.outputs.registry-paths }}"