Repository navigation
168 lines (162 loc) · 7.58 KB
/
Copy pathDeveloperDistribution.yml
File metadata and controls
168 lines (162 loc) · 7.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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 app-starter.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/app-starter.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 "[email protected]"
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