no need for pipx binary path in workflow #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm build | |
- name: Publish Executable | |
run: | | |
sudo systemctl stop portfolio | |
# Corrected find command with additional exclusions | |
sudo find /srv/portfolio/ -mindepth 1 ! -name 'media' ! -name '.env' ! -name 'log' ! -name 'tmp' -exec rm -rf {} + | |
# Use rsync to copy files, excluding media, .env, log, and tmp directories | |
sudo rsync -av --exclude 'media' --exclude '.env' --exclude 'log' --exclude 'tmp' /home/gh-runner/actions-runner/_work/portfolio/portfolio/ /srv/portfolio/ | |
cd /srv/portfolio | |
pnpm install | |
sudo systemctl start portfolio | |