-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (73 loc) · 2.8 KB
/
Copy pathrelease.yml
File metadata and controls
85 lines (73 loc) · 2.8 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
name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
release:
name: Build & publish the book
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: maven
- name: Release gate — verify the sample reactor
# JDK 21 build → activate the framework's -Pjava21 profile (the parent
# defaults to --release 25, which JDK 21 cannot target).
run: mvn -B -ntp -f samples/lumen-lending/pom.xml -Pjava21 verify
- name: Install WeasyPrint system libraries
run: |
sudo apt-get update
sudo apt-get install -y \
libpango-1.0-0 libpangocairo-1.0-0 libcairo2 \
libgdk-pixbuf-2.0-0 libffi-dev fonts-dejavu-core
- name: Set up Python toolchain
run: |
python3 -m venv build/.venv
./build/.venv/bin/python -m pip install --upgrade pip
./build/.venv/bin/pip install "weasyprint>=60" markdown pygments pyyaml cairosvg
- name: Build the English edition
run: ./build/build-book.sh --config book.yaml
- name: Build the Spanish edition
run: ./build/build-book.sh --config book.es.yaml
- name: Extract release notes from the changelog
env:
TAG_NAME: ${{ github.ref_name }}
run: |
# Strip the leading 'v' to match the "## [X.Y.Z]" changelog headings.
VERSION="${TAG_NAME#v}"
# Pull the section between "## [VERSION]" and the next "## [" heading.
awk -v ver="$VERSION" '
$0 ~ ("^## \\[" ver "\\]") { grab = 1; next }
grab && /^## \[/ { exit }
grab { print }
' CHANGELOG.md > release-notes.md
# Fall back to a generic line if the changelog had no matching section.
if [ ! -s release-notes.md ]; then
echo "Firefly for Java by Example — release ${TAG_NAME}." > release-notes.md
fi
echo "----- release-notes.md -----"
cat release-notes.md
- name: Guard that all four artifacts exist
run: |
test -f dist/firefly-java-by-example.epub
test -f dist/firefly-java-by-example.pdf
test -f dist/firefly-java-by-example-es.epub
test -f dist/firefly-java-by-example-es.pdf
- name: Publish the GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: release-notes.md
files: |
dist/firefly-java-by-example.epub
dist/firefly-java-by-example.pdf
dist/firefly-java-by-example-es.epub
dist/firefly-java-by-example-es.pdf