Fix workflow: use linux runner label for Gitea
Build and Deploy / build (push) Waiting to run
Details
Build and Deploy / build (push) Waiting to run
Details
This commit is contained in:
parent
c1871481d5
commit
886a1bca90
|
|
@ -1,17 +1,3 @@
|
||||||
# Gitea Actions - Monaco USA Portal Build & Deploy
|
|
||||||
# This workflow builds and optionally deploys the portal
|
|
||||||
#
|
|
||||||
# Triggers:
|
|
||||||
# - Push to main branch
|
|
||||||
# - Pull requests to main
|
|
||||||
# - Manual trigger (workflow_dispatch)
|
|
||||||
#
|
|
||||||
# Required Secrets (configure in Gitea repo settings):
|
|
||||||
# - DEPLOY_HOST: Production server hostname/IP
|
|
||||||
# - DEPLOY_USER: SSH username
|
|
||||||
# - DEPLOY_KEY: SSH private key for deployment
|
|
||||||
# - DEPLOY_PATH: Path to project on server (e.g., /opt/monacousa-portal)
|
|
||||||
|
|
||||||
name: Build and Deploy
|
name: Build and Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
@ -21,110 +7,44 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
deploy:
|
|
||||||
description: 'Deploy to production'
|
|
||||||
required: false
|
|
||||||
default: 'false'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# =============================================
|
|
||||||
# Build Job - Builds Docker image
|
|
||||||
# =============================================
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: linux
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Build Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./Dockerfile
|
|
||||||
push: false
|
|
||||||
load: true
|
|
||||||
tags: monacousa-portal:${{ github.sha }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
build-args: |
|
|
||||||
PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org
|
|
||||||
PUBLIC_SUPABASE_ANON_KEY=placeholder
|
|
||||||
SUPABASE_SERVICE_ROLE_KEY=placeholder
|
|
||||||
|
|
||||||
- name: Test Docker image starts
|
|
||||||
run: |
|
|
||||||
docker run -d --name test-portal \
|
|
||||||
-e PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org \
|
|
||||||
-e PUBLIC_SUPABASE_ANON_KEY=placeholder \
|
|
||||||
monacousa-portal:${{ github.sha }}
|
|
||||||
sleep 5
|
|
||||||
docker logs test-portal
|
|
||||||
docker stop test-portal
|
|
||||||
|
|
||||||
# =============================================
|
|
||||||
# Lint Job - Code quality checks
|
|
||||||
# =============================================
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci --legacy-peer-deps
|
run: npm ci --legacy-peer-deps
|
||||||
|
|
||||||
- name: Run Svelte check
|
- name: Build
|
||||||
run: npm run check || true
|
run: npm run build
|
||||||
|
env:
|
||||||
|
PUBLIC_SUPABASE_URL: https://api.portal.monacousa.org
|
||||||
|
PUBLIC_SUPABASE_ANON_KEY: placeholder
|
||||||
|
SUPABASE_SERVICE_ROLE_KEY: placeholder
|
||||||
|
|
||||||
- name: Run ESLint
|
- name: Build Docker image
|
||||||
run: npm run lint || true
|
|
||||||
|
|
||||||
# =============================================
|
|
||||||
# Deploy Job - Deploys to production server
|
|
||||||
# =============================================
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build, lint]
|
|
||||||
if: |
|
|
||||||
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
|
|
||||||
(github.event_name == 'workflow_dispatch' && github.event.inputs.deploy == 'true')
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Deploy to production
|
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.DEPLOY_HOST }}
|
|
||||||
username: ${{ secrets.DEPLOY_USER }}
|
|
||||||
key: ${{ secrets.DEPLOY_KEY }}
|
|
||||||
script: |
|
|
||||||
cd ${{ secrets.DEPLOY_PATH }}
|
|
||||||
git pull origin main
|
|
||||||
./deploy.sh update
|
|
||||||
echo "Deployment completed at $(date)"
|
|
||||||
|
|
||||||
- name: Notify deployment success
|
|
||||||
if: success()
|
|
||||||
run: |
|
run: |
|
||||||
echo "Successfully deployed to production!"
|
docker build -t monacousa-portal:${{ gitea.sha }} \
|
||||||
echo "Commit: ${{ github.sha }}"
|
--build-arg PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org \
|
||||||
echo "Branch: ${{ github.ref_name }}"
|
--build-arg PUBLIC_SUPABASE_ANON_KEY=placeholder \
|
||||||
|
--build-arg SUPABASE_SERVICE_ROLE_KEY=placeholder \
|
||||||
|
.
|
||||||
|
|
||||||
- name: Notify deployment failure
|
- name: Test container starts
|
||||||
if: failure()
|
|
||||||
run: |
|
run: |
|
||||||
echo "Deployment failed!"
|
docker run -d --name test-portal \
|
||||||
echo "Check logs for details."
|
-e PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org \
|
||||||
exit 1
|
-e PUBLIC_SUPABASE_ANON_KEY=placeholder \
|
||||||
|
monacousa-portal:${{ gitea.sha }}
|
||||||
|
sleep 5
|
||||||
|
docker logs test-portal
|
||||||
|
docker stop test-portal
|
||||||
|
docker rm test-portal
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,3 @@
|
||||||
# Gitea Actions - Monaco USA Portal Build & Deploy
|
|
||||||
# This workflow builds and optionally deploys the portal
|
|
||||||
#
|
|
||||||
# Triggers:
|
|
||||||
# - Push to main branch
|
|
||||||
# - Pull requests to main
|
|
||||||
# - Manual trigger (workflow_dispatch)
|
|
||||||
#
|
|
||||||
# Required Secrets (configure in Gitea repo settings):
|
|
||||||
# - DEPLOY_HOST: Production server hostname/IP
|
|
||||||
# - DEPLOY_USER: SSH username
|
|
||||||
# - DEPLOY_KEY: SSH private key for deployment
|
|
||||||
# - DEPLOY_PATH: Path to project on server (e.g., /opt/monacousa-portal)
|
|
||||||
|
|
||||||
name: Build and Deploy
|
name: Build and Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
@ -21,110 +7,44 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
deploy:
|
|
||||||
description: 'Deploy to production'
|
|
||||||
required: false
|
|
||||||
default: 'false'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# =============================================
|
|
||||||
# Build Job - Builds Docker image
|
|
||||||
# =============================================
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: linux
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Build Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./Dockerfile
|
|
||||||
push: false
|
|
||||||
load: true
|
|
||||||
tags: monacousa-portal:${{ github.sha }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
build-args: |
|
|
||||||
PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org
|
|
||||||
PUBLIC_SUPABASE_ANON_KEY=placeholder
|
|
||||||
SUPABASE_SERVICE_ROLE_KEY=placeholder
|
|
||||||
|
|
||||||
- name: Test Docker image starts
|
|
||||||
run: |
|
|
||||||
docker run -d --name test-portal \
|
|
||||||
-e PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org \
|
|
||||||
-e PUBLIC_SUPABASE_ANON_KEY=placeholder \
|
|
||||||
monacousa-portal:${{ github.sha }}
|
|
||||||
sleep 5
|
|
||||||
docker logs test-portal
|
|
||||||
docker stop test-portal
|
|
||||||
|
|
||||||
# =============================================
|
|
||||||
# Lint Job - Code quality checks
|
|
||||||
# =============================================
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci --legacy-peer-deps
|
run: npm ci --legacy-peer-deps
|
||||||
|
|
||||||
- name: Run Svelte check
|
- name: Build
|
||||||
run: npm run check || true
|
run: npm run build
|
||||||
|
env:
|
||||||
|
PUBLIC_SUPABASE_URL: https://api.portal.monacousa.org
|
||||||
|
PUBLIC_SUPABASE_ANON_KEY: placeholder
|
||||||
|
SUPABASE_SERVICE_ROLE_KEY: placeholder
|
||||||
|
|
||||||
- name: Run ESLint
|
- name: Build Docker image
|
||||||
run: npm run lint || true
|
|
||||||
|
|
||||||
# =============================================
|
|
||||||
# Deploy Job - Deploys to production server
|
|
||||||
# =============================================
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build, lint]
|
|
||||||
if: |
|
|
||||||
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
|
|
||||||
(github.event_name == 'workflow_dispatch' && github.event.inputs.deploy == 'true')
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Deploy to production
|
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.DEPLOY_HOST }}
|
|
||||||
username: ${{ secrets.DEPLOY_USER }}
|
|
||||||
key: ${{ secrets.DEPLOY_KEY }}
|
|
||||||
script: |
|
|
||||||
cd ${{ secrets.DEPLOY_PATH }}
|
|
||||||
git pull origin main
|
|
||||||
./deploy.sh update
|
|
||||||
echo "Deployment completed at $(date)"
|
|
||||||
|
|
||||||
- name: Notify deployment success
|
|
||||||
if: success()
|
|
||||||
run: |
|
run: |
|
||||||
echo "Successfully deployed to production!"
|
docker build -t monacousa-portal:${{ gitea.sha }} \
|
||||||
echo "Commit: ${{ github.sha }}"
|
--build-arg PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org \
|
||||||
echo "Branch: ${{ github.ref_name }}"
|
--build-arg PUBLIC_SUPABASE_ANON_KEY=placeholder \
|
||||||
|
--build-arg SUPABASE_SERVICE_ROLE_KEY=placeholder \
|
||||||
|
.
|
||||||
|
|
||||||
- name: Notify deployment failure
|
- name: Test container starts
|
||||||
if: failure()
|
|
||||||
run: |
|
run: |
|
||||||
echo "Deployment failed!"
|
docker run -d --name test-portal \
|
||||||
echo "Check logs for details."
|
-e PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org \
|
||||||
exit 1
|
-e PUBLIC_SUPABASE_ANON_KEY=placeholder \
|
||||||
|
monacousa-portal:${{ gitea.sha }}
|
||||||
|
sleep 5
|
||||||
|
docker logs test-portal
|
||||||
|
docker stop test-portal
|
||||||
|
docker rm test-portal
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue