Skip to content

Update create-build.yml #121

Update create-build.yml

Update create-build.yml #121

Workflow file for this run

---
name: Create Build
on:
push:
branches:
- deploy-github-action
jobs:
# code-quality-check:
# name: Test and Lint
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Use Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '20.x'
# - name: Install Dependencies
# run: npm ci --force
# - name: Lint
# run: npm run lint
# build:
# name: Build
# runs-on: ubuntu-latest
# needs: code-quality-check
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Use Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '20.x'
# - name: Install Dependencies
# run: npm ci --force
# - name: Run Build
# run: npm run build
# - name: Create Build Artifact
# run: |
# mkdir ./build
# cp ./.next -pR ./build/.next
# cp ./next.config.js ./build/next.config.js
# cp ./package.json ./build/package.json
# cp ./package-lock.json ./build/package-lock.json
# - name: Upload build folder
# uses: actions/upload-artifact@v4
# with:
# name: BuildArtifact
# path: ./build
# retention-days: 7
deploy:
name: Deploy to Dev
runs-on: ubuntu-latest
# needs: build
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/development.key
chmod 600 ~/.ssh/development.key
cat >>~/.ssh/config <<END
Host development
HostName $SSH_HOST
User $SSH_USERNAME
IdentityFile ~/.ssh/development.key
StrictHostKeyChecking no
END
env:
SSH_PORT: ${{secrets.SSH_PORT}}
SSH_HOST: ${{secrets.SSH_HOST}}
SSH_USERNAME: ${{secrets.SSH_USERNAME}}
SSH_KEY: ${{secrets.SSH_KEY}}
# - name: Download Build Artifact
# uses: actions/download-artifact@v4
# with:
# name: BuildArtifact
# path: ~/artifact
# - name: Copy Artifact to Environment
# run: |
# zip -r -o BuildArtifact.zip ~/artifact
# scp BuildArtifact.zip development:
# ssh development 'ls -la'
- name: Stop application
run: |
ssh development /bin/bash << EOF
sudo bash
whoami
ls -la
cd /opt/site-ui-4
ls -la
whoami
sudo bash -c pm2 list
EOF
#- name: Update site-ui-4
# run: |
# ssh development 'sudo unzip -o BuildArtifact.zip -d /opt/site-ui-4'
#- name: Restart application
# run: ssh development 'sudo pm2 startOrRestart ecosystem.config.js --env production && pm2 save'