Files
monitor-im-flur/.gitea/workflows/ci.yml
T
arif 5967b24d11
CI / build (push) Successful in 9s
CI / lint (push) Successful in 10s
CI / create-and-publish-docker-image (push) Failing after 10s
restart firefox after deploy
2026-06-27 22:07:46 +02:00

101 lines
2.9 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container:
image: oven/bun
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: bun install
- name: Prepare Vite env (build-time)
run: |
if [ -z "${VITE_FLATTASTIC_API_KEY:-}" ]; then
echo "Missing secret: VITE_FLATTASTIC_API_KEY" >&2
exit 1
fi
if [ -z "${VITE_HA_TOKEN:-}" ]; then
echo "Missing secret: VITE_HA_TOKEN" >&2
exit 1
fi
cat > .env.production <<EOF
VITE_FLATTASTIC_API_KEY=${VITE_FLATTASTIC_API_KEY}
VITE_HA_TOKEN=${VITE_HA_TOKEN}
EOF
env:
VITE_FLATTASTIC_API_KEY: ${{ secrets.VITE_FLATTASTIC_API_KEY }}
VITE_HA_TOKEN: ${{ secrets.VITE_HA_TOKEN }}
- name: Build
run: bun run build
- name: Write Git-Hash into html
run: ./pipeline/create-git-hash-html.sh
- name: Create Build Artifact
uses: christopherhx/gitea-upload-artifact@v4
with:
name: dist
path: dist
lint:
runs-on: ubuntu-latest
needs: build
container:
image: oven/bun
options: --user root
steps:
- uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: latest
token: ${{ secrets.BIOME_TOKEN }}
- name: Run Biome
run: biome ci .
create-and-publish-docker-image:
needs: [lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: christopherhx/gitea-download-artifact@v4
with:
name: dist
path: dist
- name: Log in to Docker Registry
uses: docker/login-action@v2
with:
registry: git.rivercry.com
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker image
run: docker build -t git.rivercry.com/wg/monitor-im-flur .
- name: Push Docker image
run: docker push git.rivercry.com/wg/monitor-im-flur
- name: Deploy via SSH
uses: appleboy/ssh-action@v1.0.3
with:
host: rivercry.com
port: 20022
username: docker
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
export HYPRLAND_INSTANCE_SIGNATURE=$(hyprctl instances -j | jq '.[0].instance' | tr -d '"')
cd monitor-im-flur || exit 1
git clean -dfx
git reset --hard HEAD
git pull
docker compose pull
docker compose down --remove-orphans || true
docker compose up -d
pkill -f firefox || true
hyprctl dispatch exec 'firefox -kiosk http://localhost:9123'