All checks were successful
Continuous Integration / Update Development (push) Successful in 2m24s
for some reason it seems to not be fully updating the local repo, so increase logging and double pull
95 lines
2.7 KiB
YAML
95 lines
2.7 KiB
YAML
name: Continuous Deployment
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
jobs:
|
|
Deploy:
|
|
name: Update Deployment
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
volumes:
|
|
- /var/www/html/milsim-site-v4:/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 Local Environment
|
|
run: |
|
|
which npm
|
|
npm -v
|
|
which node
|
|
node -v
|
|
which sed
|
|
sed --version
|
|
|
|
- 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
|
|
version=`git log -1 --format=%H`
|
|
echo "Current Revision: $version"
|
|
echo "Updating to: ${{ github.sha }}
|
|
sudo -u nginx git reset --hard
|
|
sudo -u nginx git pull origin main
|
|
sudo -u nginx git pull origin main
|
|
new_version=`git log -1 --format=%H`
|
|
echo "Sucessfully updated to: $new_version
|
|
|
|
- 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 / Update Version / Fix Permissions
|
|
run: |
|
|
cd /var/www/html/milsim-site-v4/ui
|
|
npm run build
|
|
version=`git describe --abbrev=0 --tags`
|
|
sed -i "s/VITE_APPLICATION_VERSION=.*/VITE_APPLICATION_VERSION=$version/" .env
|
|
chown -R nginx:nginx .
|
|
|
|
- name: Build API / Update Version / Fix Permissions
|
|
run: |
|
|
cd /var/www/html/milsim-site-v4/api
|
|
npm run build
|
|
version=`git describe --abbrev=0 --tags`
|
|
sed -i "s/APPLICATION_VERSION=.*/APPLICATION_VERSION=$version/" .env
|
|
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 |