Files
eleith a21d142e46
ci/woodpecker/pr/web-worker Pipeline was successful
ci/woodpecker/pr/web Pipeline was successful
ci/woodpecker/push/web-worker Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
[web] load prepared server template bundles
2026-10-20 18:54:09 -07:00

123 lines
3.4 KiB
YAML

name: "@luzzle/web.worker"
on:
push:
branches:
- main
tags:
- '@luzzle/web.worker@*'
paths:
- 'packages/web/worker/**'
- 'packages/web/config/**'
- 'packages/web/theme/**'
- 'packages/web/db/**'
- 'packages/web/jobs/**'
- 'packages/web/pieces/**'
- 'packages/web/templates/**'
- 'apps/core/**'
pull_request:
branches:
- main
paths:
- 'packages/web/worker/**'
- 'packages/web/config/**'
- 'packages/web/theme/**'
- 'packages/web/db/**'
- 'packages/web/jobs/**'
- 'packages/web/pieces/**'
- 'packages/web/templates/**'
- 'apps/core/**'
- '.github/workflows/web-worker.yml'
jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/web/worker
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '26'
cache: 'pnpm'
- name: Install dependencies
working-directory: .
run: pnpm install --frozen-lockfile
- name: Build shared packages
working-directory: .
run: pnpm --filter @luzzle/core --filter @luzzle/web.config --filter @luzzle/web.theme --filter @luzzle/web.db --filter @luzzle/web.jobs --filter @luzzle/web.pieces --filter @luzzle/web.templates build
- name: Lint
run: pnpm run lint
- name: Test
run: pnpm run test
- name: Build
run: pnpm run build
build-push:
needs: check
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Check Version
if: github.ref_type == 'tag'
run: |
VERSION_FROM_PKG=$(node -p "require('./packages/web/worker/package.json').version")
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION_FROM_TAG=${TAG_NAME#@luzzle/web.worker@}
if [ "$VERSION_FROM_TAG" != "$VERSION_FROM_PKG" ]; then
echo "Version mismatch: Tag version $VERSION_FROM_TAG does not match package.json version $VERSION_FROM_PKG"
exit 1
fi
echo "Version $VERSION_FROM_PKG matches."
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/eleith/luzzle-web-worker
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=match,pattern=@luzzle/web.worker@(\d+),group=1
type=match,pattern=@luzzle/web.worker@(\d+\.\d+),group=1
type=match,pattern=@luzzle/web.worker@(\d+\.\d+\.\d+),group=1
- name: Create dummy npmrc
run: touch .npmrc
- name: Log in to the Container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
file: packages/web/worker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
secrets: |
"npmrc=.npmrc"