Add .gitea/workflows/ci-deploy.yaml
Some checks failed
Continuous Integration / Update Development (push) Failing after 1m28s
Some checks failed
Continuous Integration / Update Development (push) Failing after 1m28s
create CI script based on CD script to run on every push to main and deploy on development site
This commit is contained in:
83
.gitea/workflows/ci-deploy.yaml
Normal file
83
.gitea/workflows/ci-deploy.yaml
Normal file
@@ -0,0 +1,83 @@
|
||||
name: Continuous Integration
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
Deploy:
|
||||
name: Update Development
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
volumes:
|
||||
- /var/www/html/milsim-site-v4-dev:/var/www/html/milsim-site-v4:z
|
||||
steps:
|
||||
- name: Setup Local Environment
|
||||
run: |
|
||||
groupadd -g 989 nginx || true
|
||||
useradd nginx -u 990 -g nginx -m || true
|
||||
|
||||
- name: Update Node Environment
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 20.19
|
||||
|
||||
- name: Verify Node Environment
|
||||
run: |
|
||||
which npm
|
||||
npm -v
|
||||
which node
|
||||
node -v
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: 'main'
|
||||
|
||||
- name: Token Copy
|
||||
run: |
|
||||
cd /var/www/html/milsim-site-v4
|
||||
cp /workspace/17th-Ranger-Battalion-ORG/milsim-site-v4/.git/config .git/config
|
||||
chown nginx:nginx .git/config
|
||||
|
||||
- name: Update Application Code
|
||||
run: |
|
||||
cd /var/www/html/milsim-site-v4
|
||||
sudo -u nginx git reset --hard
|
||||
sudo -u nginx git pull origin main
|
||||
|
||||
- name: Update Shared Dependencies and Fix Permissions
|
||||
run: |
|
||||
cd /var/www/html/milsim-site-v4/shared
|
||||
npm install
|
||||
chown -R nginx:nginx .
|
||||
|
||||
- name: Update UI Dependencies and Fix Permissions
|
||||
run: |
|
||||
cd /var/www/html/milsim-site-v4/ui
|
||||
npm install
|
||||
chown -R nginx:nginx .
|
||||
|
||||
- name: Update API Dependencies and Fix Permissions
|
||||
run: |
|
||||
cd /var/www/html/milsim-site-v4/api
|
||||
npm install
|
||||
chown -R nginx:nginx .
|
||||
|
||||
- name: Build UI and Fix Permissions
|
||||
run: |
|
||||
cd /var/www/html/milsim-site-v4/ui
|
||||
npm run build
|
||||
chown -R nginx:nginx .
|
||||
|
||||
- name: Build API and Fix Permissions
|
||||
run: |
|
||||
cd /var/www/html/milsim-site-v4/api
|
||||
npm run build
|
||||
chown -R nginx:nginx .
|
||||
|
||||
- name: Reset File Permissions
|
||||
run: |
|
||||
sudo chown -R nginx:nginx /var/www/html/milsim-site-v4
|
||||
sudo chmod -R u+w /var/www/html/milsim-site-v4
|
||||
Reference in New Issue
Block a user