Repository navigation
92 lines (89 loc) · 3.85 KB
/
Copy pathdocs.yml
File metadata and controls
92 lines (89 loc) · 3.85 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
name: Build Documentation
on:
release:
types: [published]
workflow_dispatch:
inputs:
selected_version:
description: 'Tag to associate with current working tree. If unset, `git describe` is used.'
type: string
required: false
permissions:
contents: read
# Needed by the "Check PR"/"Comment on PR" steps, which post the preview URL
# when the workflow is dispatched from a non-main branch that has an open PR
pull-requests: write
jobs:
build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
fetch-depth: 0
- name: Setup Zulu JDK 7
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
with:
distribution: zulu
java-version: '7'
- name: Setup Temurin JDK 25
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
with:
distribution: temurin
java-version: '25'
cache: maven
# JaCoCo report for the coverage badge, published by `just all` under current/coverage
- name: Run tests with coverage
run: |
./mvnw -B -C -ntp -V \
-Darch.id=amd64 \
-Dnative.cc=gcc \
-Dsurefire.reportFormat=plain \
-Pcoverage \
verify
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
- name: Install just
run: sudo apt install -y just
- name: Build documentation (explicit selected version)
if: github.event_name == 'workflow_dispatch' && inputs.selected_version
env:
SELECTED_VERSION: ${{ inputs.selected_version }}
run: |
[[ "$SELECTED_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Invalid selected_version: $SELECTED_VERSION" >&2; exit 1; }
cd docs && just latest_version="$SELECTED_VERSION" all
- name: Build documentation
if: github.event_name != 'workflow_dispatch' || !inputs.selected_version
run: cd docs && just all
- name: Publish production
if: github.event_name == 'release'
uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4
id: cf_publish_production
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy docs/target/site/ --project-name=lz4-java-yawk-at --branch=main
# Dispatch on main is a production rebuild; any other branch gives a preview deployment.
# wrangler-action runs the command without a shell, so the ref can't be passed via env var.
- name: Publish (manual dispatch)
if: github.event_name != 'release'
uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4
id: cf_publish_dispatch
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy docs/target/site/ --project-name=lz4-java-yawk-at --branch=${{ github.ref_name }}
# Not on main: that deploy is production, and the only associated PR is an already-merged one.
- name: Check PR
if: github.event_name != 'release' && github.ref != 'refs/heads/main'
uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0
id: pr
- name: Comment on PR
if: steps.pr.outputs.pr_found
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3
with:
message: ":rocket: Preview deployed to ${{steps.cf_publish_dispatch.outputs.deployment-url}}"
comment-tag: deployment
pr-number: "${{steps.pr.outputs.number}}"