From 1a3b096cf963843d92ebf955a356dd48037ea39d Mon Sep 17 00:00:00 2001 From: Michael Mainguy Date: Thu, 16 Oct 2025 11:18:32 -0500 Subject: [PATCH] Update to autodeploy. --- .github/workflows/build.yml | 40 +++++++++++++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..aaa5d5d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: Build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: linux_amd64 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + env: + NODE_OPTIONS: '--max-old-space-size=2048' + + - name: Extract hostname from package.json + id: get-hostname + run: | + HOSTNAME=$(node -p "require('./package.json').deployHostname") + echo "hostname=$HOSTNAME" >> $GITHUB_OUTPUT + + - name: Deploy to nginx + run: | + DEPLOY_PATH="/var/www/localhost/${{ steps.get-hostname.outputs.hostname }}" + + # Create directory if it doesn't exist + mkdir -p "$DEPLOY_PATH" + + # Copy built files (overwrite existing) + cp -r dist/* "$DEPLOY_PATH/" + echo "Deployed to $DEPLOY_PATH" \ No newline at end of file diff --git a/package.json b/package.json index 2a9d14b..8544033 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { "name": "slideshare", + "deployHostname": "slides.digital-experiment.com", "private": true, - "version": "0.0.0", + "version": "0.0.1", "type": "module", "scripts": { "dev": "npm run generate-manifest && vite",