New scroll button and top bar animations #153
This file contains hidden or 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: CI/CD - Test and Deploy UP2CLOUD Website | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| env: | |
| FORM_ENDPOINT: https://formsubmit.co/ajax/cesarnogueira1210@gmail.com | |
| jobs: | |
| test: | |
| name: Test static website | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Validate required static assets | |
| run: | | |
| test -f index.html | |
| test -f .nojekyll | |
| grep -q "UP2CLOUD" index.html | |
| echo "Static asset checks passed." | |
| - name: Run HTML and link-quality tests | |
| run: npm test | |
| terraform-validate: | |
| name: Terraform validate | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: terraform/github-pages | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: 1.8.5 | |
| - name: Terraform fmt check | |
| run: terraform fmt -check -recursive | |
| - name: Terraform init without backend | |
| run: terraform init -backend=false | |
| - name: Terraform validate | |
| run: terraform validate | |
| # Manual approval gate — runs on every PR and on pushes to main. | |
| # Requires a GitHub environment named "production-approval" with at least | |
| # one required reviewer configured under: | |
| # Settings → Environments → production-approval → Required reviewers | |
| approve: | |
| name: Awaiting approval | |
| needs: | |
| - test | |
| - terraform-validate | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production-approval | |
| steps: | |
| - name: Approval received | |
| run: echo "Deployment approved by ${{ github.actor }} ✓" | |
| build: | |
| name: Build deploy artifact | |
| needs: | |
| - approve | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Tailwind CSS | |
| run: ./node_modules/.bin/tailwindcss -i src/input.css -o assets/css/tailwind.min.css --minify | |
| - name: Prepare GitHub Pages artifact | |
| run: | | |
| rm -rf public | |
| mkdir -p public | |
| cp index.html public/index.html | |
| cp 404.html public/404.html | |
| cp .nojekyll public/.nojekyll | |
| # SEO & security files | |
| cp robots.txt public/robots.txt 2>/dev/null || true | |
| cp sitemap.xml public/sitemap.xml 2>/dev/null || true | |
| cp _headers public/_headers 2>/dev/null || true | |
| # Copy subpages and assets | |
| cp -r about public/about 2>/dev/null || true | |
| cp -r privacy public/privacy 2>/dev/null || true | |
| cp -r blog public/blog 2>/dev/null || true | |
| cp -r assets public/assets 2>/dev/null || true | |
| # Runtime production patch: make the static contact form use FormSubmit. | |
| sed -i "s#https://formspree.io/f/REPLACE_WITH_YOUR_ID#${FORM_ENDPOINT}#g" public/index.html | |
| # Add FormSubmit hidden fields into the deployed artifact if not already present. | |
| if ! grep -q 'name="_subject" value="New UP2CLOUD Lead"' public/index.html; then | |
| python3 - <<'PY' | |
| from pathlib import Path | |
| path = Path('public/index.html') | |
| html = path.read_text() | |
| marker = '<form id="contact-form" class="bg-white rounded-2xl p-8 shadow-sm border border-slate-100" novalidate aria-label="Contact form">' | |
| replacement = marker + '\n <input type="hidden" name="_captcha" value="false">\n <input type="hidden" name="_subject" value="New UP2CLOUD Lead">\n <input type="hidden" name="_template" value="table">' | |
| html = html.replace(marker, replacement) | |
| path.write_text(html) | |
| PY | |
| fi | |
| grep -q "${FORM_ENDPOINT}" public/index.html | |
| - name: Inject cache-busting version into asset URLs | |
| run: | | |
| GIT_SHA=$(git rev-parse --short HEAD) | |
| find public -name "*.html" | while read f; do | |
| sed -i "s|\(/assets/[^\"'?]*\)|\1?v=${GIT_SHA}|g" "$f" | |
| done | |
| echo "Cache-busting version: ${GIT_SHA}" | |
| - name: Upload GitHub Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: public | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' | |
| environment: | |
| name: github-pages | |
| url: https://up2cloud.github.io | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |