Skip to content

Icon Row + Container blocks #29

Icon Row + Container blocks

Icon Row + Container blocks #29

Workflow file for this run

name: C++ CI Push Main
on:
release:
types: [ published ]
branches: [ main ]
push:
branches: [main]
pull_request:
types: [ closed ]
branches:
- main
jobs:
build-and-publish-release:
runs-on: [self-hosted, Linux, X64, ubuntu-latest-lts]
if: ${{ github.event_name == 'push' && github.event.pull_request == null }}
steps:
- uses: actions/checkout@v4
- name: Load NVM and Node
run: |
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use node
- name: Source environment variables
run: |
sudo cp /srv/portfolio/.env ./
sed -i 's/^PORT=.*/PORT=3300/' .env
source .env
- name: Install pnpm
run: sudo npm install -g pnpm
- name: Stop the production server
run: sudo systemctl stop portfolio
- name: Steal ownership of production server directory
run: sudo chown -R gh-runner:gh-runner /srv/portfolio
- name: Link existing node modules
run: sudo ln -s /srv/portfolio/node_modules /home/gh-runner/actions-runner/_work/portfolio/portfolio/
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Publish Executable
run: |
sudo find /srv/portfolio/ -mindepth 1 \
! -path '/srv/portfolio/media*' \
! -path '/srv/portfolio/node_modules*' \
! -name '/srv/portfolio/.git*' \
! -name '.env' \
! -name 'log' \
! -name 'tmp' -exec rm -rf {} +
sudo rsync -av --exclude 'node_modules' --exclude 'media' --exclude '.env' --exclude '.git' \
--exclude 'log' --exclude 'tmp' /home/gh-runner/actions-runner/_work/portfolio/portfolio/ /srv/portfolio/
- name: Install deps in prod after copy to be safe
run: |
cd /srv/portfolio
pnpm install
- name: Generate updated types
run: pnpm generate:types
- name: Restore permissions in production directory
run: |
sudo chown -R www-data:www-data /srv/portfolio/
sudo chmod -R 755 /srv/portfolio/
sudo chown -R gh-runner:gh-runner /home/gh-runner/
- name: Start production server
run: sudo systemctl start portfolio