44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
# .gitea/workflows/deploy.yml
|
|
name: CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches: [main, staging]
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
- run: bun ci
|
|
- run: bun test
|
|
|
|
# Preview - handled automatically by Coolify!
|
|
# No action needed here
|
|
|
|
deploy-staging:
|
|
needs: test
|
|
if: github.ref == 'refs/heads/staging'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Trigger Coolify Staging Deploy
|
|
run: |
|
|
curl -X POST \
|
|
-H "Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}" \
|
|
"${{ secrets.COOLIFY_URL }}/api/v1/applications/${{ secrets.COOLIFY_STAGING_APP_ID }}/deploy"
|
|
|
|
deploy-prod:
|
|
needs: test
|
|
if: github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Trigger Coolify Production Deploy
|
|
run: |
|
|
curl -X POST \
|
|
-H "Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}" \
|
|
"${{ secrets.COOLIFY_URL }}/api/v1/applications/${{ secrets.COOLIFY_PROD_APP_ID }}/deploy" |