Skip to content

Commit 90f9460

Browse files
Copilotpeterkir
andauthored
Add GitHub Pages documentation site and stable latest-main release publishing (#11)
* Initial plan * Add GitHub Pages docs site and latest-main release publishing workflow Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com>
1 parent 7232a15 commit 90f9460

7 files changed

Lines changed: 709 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
outputs:
1616
dist-files: ${{ steps.collect-dist-files.outputs.files }}
17-
timestamp: ${{ steps.build-release.outputs.timestamp }}
17+
timestamp: ${{ steps.timestamp.outputs.timestamp }}
1818

1919
steps:
2020
- name: Set Timestamp
@@ -60,7 +60,7 @@ jobs:
6060
- name: Upload dist bundle (internal)
6161
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
6262
with:
63-
name: dist-bundle-${{ github.event.repository.name }}-${{ steps.build-release.outputs.timestamp }}
63+
name: dist-bundle-${{ github.event.repository.name }}-${{ steps.timestamp.outputs.timestamp }}
6464
path: |
6565
./dist/bundles/**/*.jar
6666
!./dist/bundles/**/*-javadoc*.jar
@@ -146,3 +146,53 @@ jobs:
146146
env:
147147
GITHUB_BEARER: ${{ secrets.GH_PAT_public_read_example_pde_rcp_2026 }}
148148
run: ./gradlew --no-daemon clean build
149+
150+
publish-latest-main:
151+
name: Publish latest-main release
152+
runs-on: ubuntu-latest
153+
needs:
154+
- build-release
155+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
156+
permissions:
157+
contents: write
158+
159+
steps:
160+
- name: Checkout
161+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
162+
163+
- name: Download dist bundle
164+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
165+
with:
166+
name: dist-bundle-${{ github.event.repository.name }}-${{ needs.build-release.outputs.timestamp }}
167+
path: .
168+
169+
- name: Create or update latest-main release
170+
env:
171+
GH_TOKEN: ${{ github.token }}
172+
GH_REPO: ${{ github.repository }}
173+
shell: bash
174+
run: |
175+
mapfile -t JARS < <(find dist/bundles -name "*.jar" \
176+
! -name "*-javadoc*.jar" \
177+
! -name "*-sources*.jar" \
178+
-type f | sort)
179+
180+
if [ ${#JARS[@]} -eq 0 ]; then
181+
echo "No JAR files found – skipping release update."
182+
exit 0
183+
fi
184+
185+
echo "Artifacts to publish:"
186+
printf ' %s\n' "${JARS[@]}"
187+
188+
gh release delete latest-main --yes --cleanup-tag 2>/dev/null || true
189+
190+
printf 'Automatically updated on every successful build of the `main` branch.\n\nCommit: [`%s`](https://github.com/%s/commit/%s)\n' \
191+
"${GITHUB_SHA:0:12}" "${GITHUB_REPOSITORY}" "${GITHUB_SHA}" > /tmp/release-notes.md
192+
193+
gh release create latest-main \
194+
--title "Latest main branch build" \
195+
--notes-file /tmp/release-notes.md \
196+
--prerelease \
197+
--target "${GITHUB_SHA}" \
198+
"${JARS[@]}"
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Deploy doc on GitHub Pages
2+
3+
on:
4+
# Runs after the CI workflow completes on the main branch
5+
workflow_run:
6+
workflows: ["Continuous Integration"]
7+
branches: ["main"]
8+
types: [completed]
9+
10+
# Runs on pushes targeting the main branch
11+
push:
12+
branches: ["main"]
13+
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
18+
permissions:
19+
contents: read
20+
pages: write
21+
id-token: write
22+
23+
# Allow only one concurrent deployment, skipping runs queued between the
24+
# run in-progress and latest queued. Do NOT cancel in-progress runs.
25+
concurrency:
26+
group: "pages"
27+
cancel-in-progress: false
28+
29+
jobs:
30+
# Build job
31+
doc-build:
32+
runs-on: ubuntu-latest
33+
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
37+
38+
- name: Inject source revision for docs
39+
run: 'echo "source_revision: ${GITHUB_SHA}" >> _doc/_config.yml'
40+
41+
- name: Setup Pages
42+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b
43+
44+
- name: Build with Jekyll
45+
uses: actions/jekyll-build-pages@44a6e6beabd48582f863aeeb6cb2151cc1716697
46+
with:
47+
source: ./_doc
48+
destination: ./_site
49+
50+
- name: Upload artifact
51+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa
52+
53+
# Deployment job
54+
deploy:
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
runs-on: ubuntu-latest
59+
needs: doc-build
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e

_doc/Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
gem 'github-pages', group: :jekyll_plugins
3+
gem "webrick", "~> 1.8"

_doc/_config.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
plugins:
2+
- jekyll-github-metadata
3+
- jekyll-seo-tag
4+
- jekyll-sitemap
5+
markdown: kramdown
6+
7+
github: [metadata]
8+
repository: klibio/apps
9+
10+
defaults:
11+
-
12+
scope:
13+
path: ""
14+
values:
15+
layout: default

0 commit comments

Comments
 (0)