build: add CD
This commit is contained in:
19
.gitea/workflows/1-ci.yml
Normal file
19
.gitea/workflows/1-ci.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
name: TrafficCue CI
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: latest
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun i
|
||||||
|
- name: Compile translations
|
||||||
|
run: bunx @inlang/paraglide-js compile
|
||||||
|
- run: bun run check
|
||||||
|
- run: bunx eslint
|
||||||
|
- run: bunx prettier --check .
|
||||||
42
.gitea/workflows/2-cd.yml
Normal file
42
.gitea/workflows/2-cd.yml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: TrafficCue CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, staging]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: latest
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun i
|
||||||
|
- run: bun run build
|
||||||
|
- name: Upload build artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist/
|
||||||
|
- name: Deploy build
|
||||||
|
env:
|
||||||
|
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
||||||
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||||
|
DEPLOY_PATH_MAIN: ${{ secrets.DEPLOY_PATH_MAIN }}
|
||||||
|
DEPLOY_PATH_STAGING: ${{ secrets.DEPLOY_PATH_STAGING }}
|
||||||
|
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
run: |
|
||||||
|
echo "$SSH_KEY" > private_key
|
||||||
|
chmod 600 private_key
|
||||||
|
|
||||||
|
if [ "${GITEA_REF##*/}" = "main" ]; then
|
||||||
|
TARGET_PATH=$DEPLOY_PATH_MAIN
|
||||||
|
else
|
||||||
|
TARGET_PATH=$DEPLOY_PATH_STAGING
|
||||||
|
fi
|
||||||
|
|
||||||
|
rsync -avz -e "ssh -i private_key -o StrictHostKeyChecking=no" dist/ $DEPLOY_USER@$DEPLOY_HOST:$TARGET_PATH/
|
||||||
|
|
||||||
|
rm private_key
|
||||||
@ -1,36 +0,0 @@
|
|||||||
name: TrafficCue CI
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: latest
|
|
||||||
- uses: oven-sh/setup-bun@v2
|
|
||||||
- name: Install dependencies
|
|
||||||
run: bun i
|
|
||||||
- name: Compile translations
|
|
||||||
run: bunx @inlang/paraglide-js compile
|
|
||||||
- run: bun run check
|
|
||||||
- run: bunx eslint
|
|
||||||
- run: bunx prettier --check .
|
|
||||||
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: latest
|
|
||||||
- uses: oven-sh/setup-bun@v2
|
|
||||||
- name: Install dependencies
|
|
||||||
run: bun i
|
|
||||||
- run: bun run build
|
|
||||||
- name: Upload build artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist/
|
|
||||||
Reference in New Issue
Block a user