Skip to content

Open the developer page on the interface and float the terminal behind an icon (#539) #357

Open the developer page on the interface and float the terminal behind an icon (#539)

Open the developer page on the interface and float the terminal behind an icon (#539) #357

name: Developer packages
on:
push:
tags: ['developer-v*']
branches: [develop, master]
paths:
- 'js/developer/environment/**'
- 'js/developer/scripts/**'
- 'examples/life/ui/**'
- 'js/developer/tools/**'
- 'test/developer/**'
- 'js/developer/webfront.project.json'
- 'js/developer/webfront-packages.lock.json'
- 'cmake/WebFrontBootstrap.cmake'
- 'include/webfront/system/DeveloperReleaseData.hpp'
- '.github/actions/wf-driver/**'
- '.github/actions/remove-node/**'
- '.github/actions/setup-cmake/**'
- '.github/workflows/DeveloperDistribution.yml'
pull_request:
branches: [develop, master]
paths:
- 'js/developer/environment/**'
- 'js/developer/scripts/**'
- 'examples/life/ui/**'
- 'js/developer/tools/**'
- 'test/developer/**'
- 'js/developer/webfront.project.json'
- 'js/developer/webfront-packages.lock.json'
- 'cmake/WebFrontBootstrap.cmake'
- 'include/webfront/system/DeveloperReleaseData.hpp'
- '.github/actions/wf-driver/**'
- '.github/actions/remove-node/**'
- '.github/actions/setup-cmake/**'
- '.github/workflows/DeveloperDistribution.yml'
workflow_dispatch:
inputs:
publish:
description: Publish the pinned version to GitHub Pages
type: boolean
default: false
permissions:
contents: read
concurrency:
group: developer-packages-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') }}
env:
PUBLISHING: ${{ startsWith(github.ref, 'refs/tags/developer-v') || (github.event_name == 'workflow_dispatch' && inputs.publish) }}
jobs:
# The environment builds itself: the pinned bootstrap environment runs js/developer/scripts on these sources, with the
# locked build dependencies restored from npm. No JavaScript runtime or package manager is available to any step.
wf-package:
runs-on: ubuntu-26.04
# The whole job takes about two minutes; a longer one is a stalled step (a package mirror, say): fail early.
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/remove-node
- uses: ./.github/actions/wf-driver
- name: Restore the locked build dependencies
run: wf restore
- name: Build the environment and starter packages twice
run: |
wf run build build-distribution
wf run build build-distribution-repeat
for name in environment.tgz life-starter.tgz provision.json DeveloperReleaseData.hpp; do
cmp "build-distribution/$name" "build-distribution-repeat/$name"
done
echo "environment.tgz sha512-$(openssl dgst -sha512 -binary build-distribution/environment.tgz | base64 -w0)"
- name: Check the release tag and the pinned header
run: |
building=$(jq -r .version js/developer/tools/distribution.json)
if [[ "$GITHUB_REF" == refs/tags/developer-v* ]] && [ "$GITHUB_REF_NAME" != "developer-v$building" ]; then
echo "::error::Expected the dedicated tag developer-v$building"
exit 1
fi
# The pin names the last published version. Sources at that version must rebuild it; sources ahead of it
# leave the header pinning the published archive, which is checked against the deployed file.
pinned=$(sed -n 's/.*version{"\([^"]*\)"}.*/\1/p' include/webfront/system/DeveloperReleaseData.hpp)
if [ "$pinned" = "$building" ] || [ "$PUBLISHING" = true ]; then
cmp include/webfront/system/DeveloperReleaseData.hpp build-distribution/DeveloperReleaseData.hpp
else
echo "::notice::Sources build $building; DeveloperReleaseData.hpp still pins the published $pinned."
wf run pin
fi
# The specs of the environment run by the project's own wf test, under the locked jasmine-core.
- name: Run the specs of the environment
run: wf test --timeout 300
- uses: actions/upload-artifact@v4
with:
name: developer-distribution
if-no-files-found: error
path: |
build-distribution/environment.tgz
build-distribution/life-starter.tgz
build-distribution/provision.json
build-distribution/DeveloperReleaseData.hpp
publish:
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/developer-v') || (github.event_name == 'workflow_dispatch' && inputs.publish))
needs: wf-package
runs-on: ubuntu-26.04
timeout-minutes: 15
permissions:
contents: write
pages: write
concurrency:
group: developer-pages-publication
cancel-in-progress: false
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/remove-node
- uses: ./.github/actions/wf-driver
- name: Restore the locked build dependencies
run: wf restore
- uses: actions/download-artifact@v4
with:
name: developer-distribution
path: build-distribution
- name: Check the configured Pages source before pushing
run: bash js/developer/tools/pages.sh --check
- name: Preserve existing versions and publish the static branch
shell: bash
run: |
set -euo pipefail
gh auth setup-git
# In the workspace, since the wf script writes inside the project (permissions.publish of js/developer/webfront.project.json).
site=build-site
git init --initial-branch=gh-pages "$site"
git -C "$site" remote add origin "https://github.com/$GITHUB_REPOSITORY.git"
result=0
git -C "$site" ls-remote --exit-code --heads origin gh-pages > "$RUNNER_TEMP/developer-pages-ref" || result=$?
if [ "$result" = 0 ]; then
git -C "$site" fetch --depth=1 origin gh-pages
git -C "$site" switch --detach FETCH_HEAD
elif [ "$result" != 2 ]; then
exit "$result"
fi
# A CNAME left over from a custom domain must not outlive a base URL that returns to github.io: remove it, which the
# commit below records as a deletion. The script refuses a site that still has one.
host=$(jq -r '.baseUrl | sub("^https://"; "") | sub("[/:].*$"; "")' js/developer/tools/distribution.json)
case "$host" in *.github.io) git -C "$site" rm -q --ignore-unmatch CNAME ;; esac
wf run site build-distribution "$site"
git -C "$site" config user.name "$GITHUB_ACTOR"
git -C "$site" config user.email "$GITHUB_ACTOR@users.noreply.github.com"
git -C "$site" add .nojekyll index.html developer
# The custom domain of the base URL, when it has one.
if [ -e "$site/CNAME" ]; then git -C "$site" add CNAME; fi
if ! git -C "$site" diff --cached --quiet; then
version=$(jq -r .version js/developer/tools/distribution.json)
git -C "$site" commit -m "Publish developer packages $version [#288]"
git -C "$site" push origin HEAD:refs/heads/gh-pages
fi
- name: Request the configured Pages build
run: bash js/developer/tools/pages.sh
- name: Archive tagged packages in a dedicated prerelease
if: startsWith(github.ref, 'refs/tags/developer-v')
env:
RELEASE_TAG: ${{ github.ref_name }}
run: bash js/developer/tools/archive-release.sh "$RELEASE_TAG" build-distribution