Skip to content

feat(admob): publish app-ads.txt for LapsCounter #58

feat(admob): publish app-ads.txt for LapsCounter

feat(admob): publish app-ads.txt for LapsCounter #58

Workflow file for this run

name: Build and Deploy Static Export
on:
push:
tags:
- 'v*' # Triggers on any tag starting with 'v' (e.g., v1.0.0, v1.2.3)
pull_request:
branches: [main] # Build PRs for testing, but don't deploy
jobs:
build:
runs-on: ubuntu-latest
environment: deploy
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Updated to match project's Node version requirements
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build static export
run: npm run build # This will run next build which generates the 'out' directory
- name: Copy Apache configuration
run: cp .htaccess out/.htaccess
- name: Verify build output
run: |
echo "Checking if build succeeded..."
ls -la out/
echo "Build output files:"
find out/ -type f | head -10
- name: Mask serialized FTP credentials
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
env:
FTP_HOST_RAW: ${{ secrets.FTP_HOST }}
FTP_USERNAME_RAW: ${{ secrets.FTP_USERNAME }}
FTP_PASSWORD_RAW: ${{ secrets.FTP_PASSWORD }}
run: |
node <<'NODE'
const names = ['FTP_HOST_RAW', 'FTP_USERNAME_RAW', 'FTP_PASSWORD_RAW'];
const escapeCommandData = (value) => value
.replace(/%/g, '%25')
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A');
for (const name of names) {
const serialized = JSON.stringify(process.env[name] ?? '');
process.stdout.write(`::add-mask::${escapeCommandData(serialized)}\n`);
}
NODE
- name: Deploy Next.js assets (excluding app chunks)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: Wandalen/wretry.action@v3.8.0
with:
action: SamKirkland/FTP-Deploy-Action@v4.3.6
attempt_limit: 3
attempt_delay: 15000
with: |
server: ${{ toJSON(secrets.FTP_HOST) }}
username: ${{ toJSON(secrets.FTP_USERNAME) }}
password: ${{ toJSON(secrets.FTP_PASSWORD) }}
local-dir: ./out/_next/
server-dir: ./_next/
state-name: .ftp-deploy-sync-state.json
exclude: |
**/static/chunks/app/**
- name: Deploy Next.js app chunks
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: Wandalen/wretry.action@v3.8.0
with:
action: SamKirkland/FTP-Deploy-Action@v4.3.6
attempt_limit: 3
attempt_delay: 15000
with: |
server: ${{ toJSON(secrets.FTP_HOST) }}
username: ${{ toJSON(secrets.FTP_USERNAME) }}
password: ${{ toJSON(secrets.FTP_PASSWORD) }}
local-dir: ./out/_next/static/chunks/app/
server-dir: ./_next/static/chunks/app/
state-name: .ftp-deploy-sync-state.json
- name: Deploy site files to FTP
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: Wandalen/wretry.action@v3.8.0
with:
action: SamKirkland/FTP-Deploy-Action@v4.3.6
attempt_limit: 3
attempt_delay: 15000
with: |
server: ${{ toJSON(secrets.FTP_HOST) }}
username: ${{ toJSON(secrets.FTP_USERNAME) }}
password: ${{ toJSON(secrets.FTP_PASSWORD) }}
local-dir: ./out/
server-dir: ./
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
**/.DS_Store
**/_next/**
dry-run: false