Refresh Inner Breeze website and deploy it from Gitea
Cloudflare Pages / Build and verify the site (push) Failing after 3m32s
Cloudflare Pages / Build and verify the site (push) Failing after 3m32s
This commit is contained in:
1 parent
3423cba76d
commit
43be710898
19 files changed
+537
-290
No files matched your search
+16
-185
@@ -1,200 +1,31 @@
|
||||
name: Cloudflare Pages
|
||||
name: Refresh Gitea Pages after release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
# Refresh available downloads after a release; pushes deploy independently.
|
||||
workflow_run:
|
||||
workflows: [Release]
|
||||
types: [completed]
|
||||
branches: [master]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
released_web:
|
||||
description: Use the published web app for a website-only update
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
# A failed Release produces a skipped refresh, which must not cancel a push.
|
||||
group: pages-${{ github.ref }}-${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success' && 'skipped' || 'deploy' }}
|
||||
# Finish the active deployment; newer pushes replace only the pending refresh.
|
||||
cancel-in-progress: false
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Site
|
||||
refresh-gitea-after-release:
|
||||
name: Refresh Gitea Pages after a successful release
|
||||
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
|
||||
env:
|
||||
# Production follows the phone-verified release; previews test new source.
|
||||
USE_RELEASED_WEB: ${{ github.event_name != 'pull_request' || inputs.released_web }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: true
|
||||
|
||||
- name: Fetch Ziran packages
|
||||
uses: ./.github/actions/ziran-packages
|
||||
|
||||
- name: Set up Node.js for the web build
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Resolve published downloads
|
||||
- name: Dispatch the current Gitea master workflow
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
BREEZE_PAGES_DISPATCH_TOKEN: ${{ secrets.BREEZE_PAGES_DISPATCH_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gh api repos/waozixyz/breeze/releases/latest > "$RUNNER_TEMP/inbe-published-release.json"
|
||||
python3 - "$RUNNER_TEMP/inbe-published-release.json" >> "$GITHUB_ENV" <<'PY'
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
release = json.loads(Path(sys.argv[1]).read_text())
|
||||
tag = release["tag_name"]
|
||||
version = tag.removeprefix("v")
|
||||
assert re.fullmatch(r"(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)", version), "Invalid published release version"
|
||||
assets = {asset["name"] for asset in release["assets"]}
|
||||
candidates = [f"inbe-{version}-arm64-v8a.apk", f"inbe-{version}.apk"]
|
||||
android = next((name for name in candidates if name in assets), None)
|
||||
assert android is not None, "Published release has no compatible Android APK"
|
||||
print(f"SITE_RELEASE_VERSION={version}")
|
||||
print(f"SITE_ANDROID_APK_ASSET={android}")
|
||||
PY
|
||||
|
||||
- name: Install Packages
|
||||
if: ${{ env.USE_RELEASED_WEB != 'true' }}
|
||||
timeout-minutes: 15
|
||||
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt python3-pil
|
||||
|
||||
- name: Set Up Emscripten
|
||||
if: ${{ env.USE_RELEASED_WEB != 'true' }}
|
||||
uses: ./.github/actions/emscripten
|
||||
|
||||
- name: Download Released Web App
|
||||
if: ${{ env.USE_RELEASED_WEB == 'true' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version="$SITE_RELEASE_VERSION"
|
||||
test -n "$version"
|
||||
mkdir -p build/released-web build/dist/web
|
||||
gh release download "v$version" --pattern inbe-web.zip --dir build/released-web
|
||||
unzip -q build/released-web/inbe-web.zip -d build/dist/web
|
||||
test -s build/dist/web/index.wasm
|
||||
|
||||
- name: Web runner diagnostics
|
||||
if: ${{ env.USE_RELEASED_WEB != 'true' }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
lscpu
|
||||
free -m
|
||||
for browser in chromium chromium-browser google-chrome google-chrome-stable; do
|
||||
if command -v "$browser" >/dev/null 2>&1; then
|
||||
"$browser" --version
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Build Site
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ "$USE_RELEASED_WEB" = "true" ]; then
|
||||
make package-unpackaged-assets
|
||||
sh site/build.sh
|
||||
else
|
||||
export PATH="$INBE_NODE_BIN:$PATH"
|
||||
node --version
|
||||
make build-laws
|
||||
make site
|
||||
if [ -z "$BREEZE_PAGES_DISPATCH_TOKEN" ]; then
|
||||
echo '::warning::BREEZE_PAGES_DISPATCH_TOKEN is missing'
|
||||
exit 0
|
||||
fi
|
||||
test -f build/site/index.html
|
||||
test -f build/site/build/web/index.html
|
||||
test -f build/site/build/web/index.js
|
||||
test -f build/site/build/web/index.wasm || test -f build/site/build/web/index.wasm.gz || test -f build/site/build/web/index.wasm.parts.json
|
||||
if [ "$GITHUB_EVENT_NAME" != "pull_request" ]; then
|
||||
make site-release-assets-check
|
||||
else
|
||||
echo "Skipping release asset availability check for pull request build"
|
||||
fi
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
# apt users follow the published release at https://breeze.waozi.xyz/apt.
|
||||
- name: Build APT Repository
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
APT_SIGNING_KEY: ${{ secrets.APT_SIGNING_KEY }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
command -v apt-ftparchive >/dev/null || sudo apt-get install -y --no-install-recommends apt-utils
|
||||
sh scripts/build-apt-repo.sh build/site/apt "$SITE_RELEASE_VERSION"
|
||||
|
||||
- name: Upload Web diagnostics after a failed build
|
||||
if: ${{ failure() && env.USE_RELEASED_WEB != 'true' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: inbe-web-diagnostics
|
||||
path: build/dist/web
|
||||
if-no-files-found: warn
|
||||
retention-days: 3
|
||||
|
||||
- name: Upload Site Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: inbe-site
|
||||
path: build/site
|
||||
if-no-files-found: error
|
||||
|
||||
deploy-preview:
|
||||
name: Deploy Preview
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name == 'pull_request'
|
||||
|
||||
steps:
|
||||
- name: Download Site Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: inbe-site
|
||||
path: build/site
|
||||
|
||||
- name: Deploy Preview To Cloudflare Pages
|
||||
uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: pages deploy build/site --project-name=inbe --branch=${{ github.head_ref || github.ref_name }} --commit-hash=${{ github.sha }}
|
||||
|
||||
deploy-production:
|
||||
name: Deploy Production
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
|
||||
|
||||
steps:
|
||||
- name: Download Site Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: inbe-site
|
||||
path: build/site
|
||||
|
||||
- name: Deploy Production To Cloudflare Pages
|
||||
uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: pages deploy build/site --project-name=inbe --branch=master --commit-hash=${{ github.sha }}
|
||||
curl --fail-with-body --silent --show-error --max-time 30 \
|
||||
--request POST \
|
||||
--header "Authorization: token $BREEZE_PAGES_DISPATCH_TOKEN" \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{"ref":"master"}' \
|
||||
'https://git.waozi.xyz/api/v1/repos/waozi/breeze/actions/workflows/pages.yml/dispatches'
|
||||
Reference in new issue
Block a user