This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
name: Validate and publish Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
pages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Validate static site
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -s index.html
|
||||
test -s styles.css
|
||||
test -s script.js
|
||||
test -s assets/donatas-hero.jpg
|
||||
test -s assets/donatas-gitara.jpg
|
||||
test -s assets/donatas-scena.jpg
|
||||
grep -Fq 'MIKROFONĄ' index.html
|
||||
grep -Fq 'vedejasdumas.lt' index.html
|
||||
grep -Fq 'border-radius:0!important' styles.css
|
||||
|
||||
- name: Prepare build
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm -rf build
|
||||
mkdir -p build/assets
|
||||
cp index.html styles.css script.js build/
|
||||
cp assets/*.jpg build/assets/
|
||||
test -f build/index.html
|
||||
|
||||
- name: Publish to LEGO Cloud Pages
|
||||
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
ORG_REPO='${{ gitea.repository }}'
|
||||
case "$ORG_REPO" in */*) ;; *) exit 1 ;; esac
|
||||
case "$ORG_REPO" in *..*|/*|*/|*//* ) exit 1 ;; esac
|
||||
test -f build/index.html
|
||||
pages_root='/gondor-v1-gitea-pages'
|
||||
mountpoint -q "$pages_root" || { echo "$pages_root is not a persistent mount" >&2; exit 1; }
|
||||
destination="$pages_root/$ORG_REPO"
|
||||
rm -rf -- "$destination"
|
||||
mkdir -p "$destination"
|
||||
cp -a build/. "$destination/"
|
||||
Reference in New Issue
Block a user