Repository navigation
129 lines (112 loc) · 3.84 KB
/
Copy pathbuild.yml
File metadata and controls
129 lines (112 loc) · 3.84 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
name: SmallRye Website
on:
push:
branches:
- develop
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- 'NOTICE'
- 'README*'
pull_request:
branches:
- develop
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- 'NOTICE'
- 'README*'
# Daily, so a post dated later than the merge publishes on its date
# (future-dated posts are left out until then), and the docs pick up new releases.
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
# One deploy at a time: a second run queues behind the first instead of racing its push.
concurrency:
group: website-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
services:
kroki:
image: yuzutech/kroki
env:
KROKI_MERMAID_HOST: kroki-mermaid
ports:
- 8000:8000
kroki-mermaid:
image: yuzutech/kroki-mermaid
steps:
- name: checkout
uses: actions/checkout@v4
with:
# The sitemap plugin reads each page's last change from git history.
fetch-depth: 0
# Before the site: the Roq build leaves a node_modules/ in the repository root, and
# npm would install Antora there instead of in docs/.
- name: generate docs
run: |
cd docs
# asciidoctor-kroki must stay on 0.18.1: since 1.0.0, its extensions are
# async and require Asciidoctor.js 4, while Antora 2.3 uses Asciidoctor.js 1.5.9
npm i @antora/cli@2.3 @antora/site-generator-default@2.3 asciidoctor-kroki@0.18.1
./node_modules/@antora/cli/bin/antora --stacktrace generate antora-playbook.yml
- name: generate website
uses: quarkiverse/quarkus-roq@v1.1
with:
github-pages: 'false'
site-url: 'https://smallrye.io'
# A page that carries its own stylesheet can be drawn from the first file the
# browser receives, without a second request.
- name: put the stylesheet in the pages
run: java .github/InlineStyles.java target/roq
- name: add docs to the website
run: cp -r docs/build/site target/roq/docs
- name: attach website
uses: actions/upload-artifact@v4
with:
name: website
path: target/roq
include-hidden-files: true
deploy:
needs: [build]
if: github.event_name != 'pull_request' && github.repository_owner == 'smallrye'
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
name: Create GitHub App Token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
ref: main
token: ${{steps.app-token.outputs.token}}
- 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: Configure Git author
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
- name: extract website
uses: actions/download-artifact@v4
with:
name: website
- name: push website
run: |
git add -A .
# The daily run often has nothing new to publish.
if git diff --cached --quiet; then
echo "Website unchanged, nothing to deploy"
exit 0
fi
git status --short | head -50
git commit -m "CI: Build and deploy website updates"
git push --force