A variable declared inside a try block but read after it shipped and broke collection checks for a day; tests can't reach that path and node --check only parses. ESLint flags it as no-undef. Wired into npm run lint / check and into CI before the image build, so a failure stops the build. Three findings fixed on the way: an unread argument, and two values assigned then immediately replaced. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
37 lines
1.2 KiB
YAML
37 lines
1.2 KiB
YAML
name: build-and-push
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ['v*']
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Lint and test
|
|
# In the runner's own Docker, so this needs no extra actions. A failure
|
|
# here stops the image being built, rather than deploying a broken one.
|
|
run: |
|
|
docker run --rm -v "$PWD":/src -w /src node:22-bookworm-slim \
|
|
sh -c "npm ci --no-audit --no-fund && npm run lint && npm test"
|
|
|
|
- name: Log in to the Forgejo container registry
|
|
# REGISTRY_TOKEN = a Forgejo access token with write:package scope, added
|
|
# as a repo Actions secret. The auto GITHUB_TOKEN can't push packages.
|
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.plexultra.com -u "${{ github.repository_owner }}" --password-stdin
|
|
|
|
- name: Build and push image
|
|
run: |
|
|
IMAGE="git.plexultra.com/${{ github.repository }}"
|
|
SHA="${{ github.sha }}"
|
|
docker build -t "$IMAGE:latest" -t "$IMAGE:${SHA:0:12}" .
|
|
docker push "$IMAGE:latest"
|
|
docker push "$IMAGE:${SHA:0:12}"
|