build and deploy

This commit is contained in:
2026-08-16 12:22:52 +02:00
parent 1f7402733e
commit d02b7db5a4
+101
View File
@@ -0,0 +1,101 @@
name: Build & Deploy moonweb.org
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: "22"
jobs:
build:
name: Build moonweb.org
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Validate build output
run: |
if [ ! -d "_site" ]; then
echo "Error: _site not found"
exit 1
fi
if [ -z "$(ls -A _site 2>/dev/null)" ]; then
echo "Error: _site is empty"
exit 1
fi
echo "Build output:"
find _site -type f | head -20
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: dist-moonweb
path: _site
retention-days: 7
deploy:
name: Deploy moonweb.org
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Download build artifact
uses: actions/download-artifact@v8
with:
name: dist-moonweb
path: _site
- name: Deploy via SFTP to IONOS
uses: wlixcc/SFTP-Deploy-Action@v1.2.6
with:
local_path: './_site/*'
server: ${{ secrets.IONOS_SFTP_HOST }}
username: ${{ secrets.IONOS_SFTP_USER }}
password: ${{ secrets.IONOS_SFTP_PASSWORD }}
remote_path: '/deploy/moonweb/'
port: 22
sftp_only: true
summary:
name: Deploy Summary
needs: deploy
runs-on: ubuntu-latest
if: always()
steps:
- name: Print deployment summary
run: |
echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.deploy.result }}" = "success" ]; then
echo "✅ moonweb.org deployed successfully!" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Deployment failed. Check the deploy job for details." >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Site" >> $GITHUB_STEP_SUMMARY
echo "| Site | URL |" >> $GITHUB_STEP_SUMMARY
echo "|------|-----|" >> $GITHUB_STEP_SUMMARY
echo "| moonweb | https://www.moonweb.org |" >> $GITHUB_STEP_SUMMARY
# Required repo secrets:
# IONOS_SFTP_HOST — IONOS SFTP server hostname
# IONOS_SFTP_USER — IONOS SFTP username
# IONOS_SFTP_PASSWORD — IONOS SFTP password