85 lines
2.5 KiB
YAML
85 lines
2.5 KiB
YAML
name: Dimension Lab website
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: dimensionlab-website-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
jobs:
|
|
ci:
|
|
runs-on: docker
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://data.forgejo.org/actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: false
|
|
|
|
- name: Initialize submodules
|
|
run: |
|
|
git config --global url."https://git.dimensionlab.net/".insteadOf "ssh://git@git.dimensionlab.net/"
|
|
git submodule update --init --recursive
|
|
|
|
- name: Install Bun
|
|
run: |
|
|
curl -fsSL https://bun.sh/install | bash -s "bun-v1.3.14"
|
|
"$HOME/.bun/bin/bun" --version
|
|
|
|
- name: Check, test, and build
|
|
run: |
|
|
export BUN_INSTALL="$HOME/.bun"
|
|
export PATH="$BUN_INSTALL/bin:$PATH"
|
|
bun install --frozen-lockfile
|
|
bun run check
|
|
bun run test
|
|
bun run build
|
|
|
|
deploy:
|
|
needs: ci
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
runs-on: deploy
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
if [ -d .git ]; then
|
|
git remote set-url origin git@git.dimensionlab.net:vince/dimensionlab-website.git
|
|
else
|
|
git init
|
|
git remote add origin git@git.dimensionlab.net:vince/dimensionlab-website.git
|
|
fi
|
|
git fetch --force --prune --depth=1 origin "$GITHUB_SHA"
|
|
git checkout --force --detach "$GITHUB_SHA"
|
|
git clean -ffdx
|
|
|
|
- name: Initialize submodules
|
|
run: |
|
|
git config --global url."https://git.dimensionlab.net/".insteadOf "ssh://git@git.dimensionlab.net/"
|
|
git submodule update --init --recursive
|
|
|
|
- name: Verify Podman deployment socket
|
|
run: |
|
|
command -v podman
|
|
command -v systemctl
|
|
unit="$(timeout 15s podman inspect dimensionlab-website --format '{{ index .Config.Labels "PODMAN_SYSTEMD_UNIT" }}')"
|
|
test "$unit" = "dimensionlab-website.service"
|
|
|
|
- name: Deploy production website
|
|
env:
|
|
DEPLOY_CONTAINER_CLI: podman
|
|
DEPLOY_EVENT_NAME: ${{ github.event_name }}
|
|
DEPLOY_REF: ${{ github.ref }}
|
|
DEPLOY_RESTART_STRATEGY: quadlet-container
|
|
DEPLOY_SHA: ${{ github.sha }}
|
|
run: scripts/deploy-dimensionlab-website.sh
|