Skip to content

Merge pull request #349 from AugistineCreates/feature/keyboard-naviga… #2

Merge pull request #349 from AugistineCreates/feature/keyboard-naviga…

Merge pull request #349 from AugistineCreates/feature/keyboard-naviga… #2

Workflow file for this run

name: Extension CI
on:
push:
tags:
- "v*"
paths:
- "extension/**"
branches: [main, develop]
pull_request:
paths:
- "extension/**"
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: extension
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Derive version
id: version
run: |
TAG="${GITHUB_REF_NAME}"
if [[ "$TAG" =~ ^v([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?)$ ]]; then
VERSION="${BASH_REMATCH[1]}"
else
# For branch pushes, derive version from manifest.json
VERSION=$(node -e "console.log(require('./manifest.json').version)")
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Using version: $VERSION"
export VERSION
python - <<'PY'
import json, os
from pathlib import Path
manifest_path = Path("manifest.json")
data = json.loads(manifest_path.read_text())
data["version"] = os.environ["VERSION"]
manifest_path.write_text(json.dumps(data, indent=2) + "\n")
PY
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: extension/package-lock.json
- run: npm ci
- run: npm run build
- name: Verify build output
run: test -f dist/content-script.js
- uses: actions/upload-artifact@v4
with:
name: extension-dist
path: extension/dist/
retention-days: 7