-
Notifications
You must be signed in to change notification settings - Fork 604
126 lines (107 loc) · 4.81 KB
/
build_new_docs.yaml
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
# Copyright © SixtyFPS GmbH <[email protected]>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
name: Build New Docs
on:
push:
branches: ["docs-tng"]
pull_request:
branches: [master, "feature/*"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
docs:
runs-on: macos-14
env:
# Allow deprecated warning because we are using nightly and some things might be deprecated in nightly
# for which the stable alternative is not yet available.
RUSTFLAGS: -D warnings -W deprecated
RUSTDOCFLAGS: --html-in-header=/home/runner/work/slint/slint/docs/resources/slint-docs-highlight.html -D warnings -W deprecated
SLINT_NO_QT: 1
CARGO_INCREMENTAL: false
RELEASE_INPUT: ${{ inputs.release }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/[email protected]
with:
version: 9.11.0
- uses: ./.github/actions/setup-rust
with:
toolchain: nightly
- uses: actions/setup-python@v5
with:
python-version: '3.12'
# - uses: ./.github/actions/install-linux-dependencies
# with:
# extra-packages: libfontconfig-dev fonts-open-sans ttf-mscorefonts-installer
# - name: Check license headers
# run: cargo xtask check_license_headers --fix-it
# - name: Suggest license header changes
# uses: reviewdog/action-suggester@v1
# with:
# tool_name: xtask license_header
# level: error
# fail_on_error: true
# - run: sudo apt-get install reuse
# - name: Check reuse compliance
# run: cargo xtask check_reuse_compliance
# Generate screenshots
#
# Note: This is not part of the xtask to avoid the xtask depending on all of slint!
- name: Generate screenshots
run: cargo run -p slint-docsnapper -- docs/src/content
# Build Docs
- name: Run slintdocs xtask
run: cargo xtask slintdocs
# Test docs
- name: Run Playwright tests
run: cd docs && pnpm exec playwright test
- name: Publish Test Summary Results
run: cd docs && npx github-actions-ctrf playwright-report/ctrf-report.json
- name: Check spelling
run: cd docs && pnpm spellcheck
# Commit to www-releases/snapshots/tng
- name: Generate a token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.READ_WRITE_APP_ID }}
private-key: ${{ secrets.READ_WRITE_PRIVATE_KEY }}
repositories: www-releases
- name: Clone www-releases/snapshots directory
uses: actions/checkout@v4
with:
repository: slint-ui/www-releases
path: www-releases
token: ${{ steps.app-token.outputs.token }}
sparse-checkout: |
snapshots/tng
- name: copy docs to www-releases
run: |
rm -rf www-releases/snapshots/tng
mkdir -p www-releases/snapshots/tng
cp -a docs/dist/* www-releases/snapshots/tng
ls -l www-releases/snapshots/tng/
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: check for diff
id: www-releases
working-directory: ./www-releases
run: |
git diff-index --quiet HEAD || echo "has-diff=yes" >> "$GITHUB_OUTPUT"
- name: commit and push
working-directory: ./www-releases
run: |
git config user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
git add .
git add -u .
git commit --message "Update $NAME from $GITHUB_REPOSITORY" --message "Update tng docs from commit $GITHUB_SHA ($GITHUB_REF)"
git push