Reviewed-on: https://home.schmelczer.dev/git/git/andras/decla-red/pulls/3
63 lines
1.7 KiB
YAML
63 lines
1.7 KiB
YAML
name: Build & deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ['v*']
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ gitea.workflow }}-${{ gitea.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# ---- Static website -> /pages mount on the runner host --------------------
|
|
website:
|
|
name: Build & deploy website
|
|
runs-on: docker
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: .nvmrc
|
|
|
|
- name: Install dependencies
|
|
# No lockfiles are committed (see .gitignore), so use `npm install`.
|
|
run: npm install && npm run init
|
|
|
|
- name: Build (shared -> frontend -> backend)
|
|
run: npm run build
|
|
|
|
- name: Test
|
|
run: npm test
|
|
|
|
- name: Lint
|
|
run: npm run lint:check
|
|
|
|
- name: Deploy to host pages mount
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
uses: http://forgejo:3000/andras/ci-actions/deploy-pages@main
|
|
with:
|
|
source: frontend/dist
|
|
target: declared
|
|
|
|
# ---- Server Docker image -> Forgejo container registry --------------------
|
|
server-image:
|
|
name: Build & publish server image
|
|
runs-on: docker
|
|
# No registry push on PRs; build validation still happens in the website job.
|
|
if: github.event_name != 'pull_request'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build and publish server image
|
|
uses: http://forgejo:3000/andras/ci-actions/docker-publish@main
|
|
with:
|
|
context: .
|
|
image-suffix: -server
|
|
token: ${{ secrets.FORGEJO_PACKAGE_TOKEN }}
|