diff --git a/.gitea/workflows/1-ci.yml b/.gitea/workflows/1-ci.yml new file mode 100644 index 0000000..74972b8 --- /dev/null +++ b/.gitea/workflows/1-ci.yml @@ -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 . \ No newline at end of file diff --git a/.gitea/workflows/2-cd.yml b/.gitea/workflows/2-cd.yml new file mode 100644 index 0000000..1c05d99 --- /dev/null +++ b/.gitea/workflows/2-cd.yml @@ -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 \ No newline at end of file diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml deleted file mode 100644 index 11b7d19..0000000 --- a/.gitea/workflows/ci.yml +++ /dev/null @@ -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/