Skip to content

Commit 2915f9c

Browse files
committed
reduce with version replace
1 parent 4302c83 commit 2915f9c

File tree

6 files changed

+13
-50
lines changed

6 files changed

+13
-50
lines changed

.github/workflows/reduce-adoc.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ on:
33
push:
44
paths:
55
- '**/*-source.adoc'
6-
- 'version.adoc.template'
76
- 'pom.xml'
87
branches: ['**']
98
workflow_dispatch:
@@ -28,16 +27,6 @@ jobs:
2827
- name: Install asciidoctor-reducer
2928
run: gem install --no-document asciidoctor-reducer
3029

31-
- name: Setup Java
32-
uses: actions/setup-java@v4
33-
with:
34-
distribution: 'temurin'
35-
java-version: '8'
36-
cache: 'maven'
37-
38-
- name: Generate version.adoc
39-
run: mvn generate-resources
40-
4130
- name: Reduce all *-source.adoc files
4231
shell: bash
4332
run: |
@@ -50,5 +39,15 @@ jobs:
5039
asciidoctor-reducer --preserve-conditionals -o "$out" "$src"
5140
done
5241
42+
- name: Replace version placeholders
43+
shell: bash
44+
run: |
45+
set -euo pipefail
46+
# Extract version from pom.xml using grep
47+
VERSION=$(grep -oP '<version>\K[^<]+' pom.xml | head -1)
48+
echo "Replacing {project-version} with $VERSION"
49+
# Replace in all generated .adoc files (but not -source.adoc files)
50+
find . -type f -name '*.adoc' ! -name '*-source.adoc' -exec sed -i "s/{project-version}/$VERSION/g" {} \;
51+
5352
- name: Commit reduced files
5453
uses: EndBug/add-and-commit@v9

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,4 @@ test-push.sh
3030

3131
.DS_Store
3232

33-
src/main/antlr4/.antlr
34-
35-
# Auto-generated version file
36-
version.adoc
33+
src/main/antlr4/.antlr

README-EN-source.adoc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
:toc:
22

3-
include::version.adoc[]
4-
53
= QLExpress
64

75
image::images/logo.png[]
@@ -106,7 +104,7 @@ QLExpress4 supports omitting semicolons, making expressions more concise. For de
106104

107105
=== Adding Dependencies
108106

109-
[source,xml]
107+
[source,xml,subs="attributes+"]
110108
----
111109
<dependency>
112110
<groupId>com.alibaba</groupId>

README-source.adoc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
:toc:
22

3-
include::version.adoc[]
4-
53
= QLExpress
64

75
image::images/logo.png[]
@@ -108,7 +106,7 @@ QLExpress4 支持省略分号,让表达式更加简洁。具体参考 link:#
108106

109107
=== 引入依赖
110108

111-
[source,xml]
109+
[source,xml,subs="attributes+"]
112110
----
113111
<dependency>
114112
<groupId>com.alibaba</groupId>

pom.xml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -284,32 +284,6 @@
284284
<groupId>org.jacoco</groupId>
285285
<artifactId>jacoco-maven-plugin</artifactId>
286286
</plugin>
287-
<!-- Maven AntRun Plugin for version.adoc generation -->
288-
<plugin>
289-
<groupId>org.apache.maven.plugins</groupId>
290-
<artifactId>maven-antrun-plugin</artifactId>
291-
<version>3.1.0</version>
292-
<executions>
293-
<execution>
294-
<id>generate-version-adoc</id>
295-
<phase>generate-resources</phase>
296-
<goals>
297-
<goal>run</goal>
298-
</goals>
299-
<configuration>
300-
<target>
301-
<copy file="${project.basedir}/version.adoc.template"
302-
tofile="${project.basedir}/version.adoc"
303-
overwrite="true">
304-
<filterset>
305-
<filter token="project.version" value="${project.version}"/>
306-
</filterset>
307-
</copy>
308-
</target>
309-
</configuration>
310-
</execution>
311-
</executions>
312-
</plugin>
313287
</plugins>
314288
</build>
315289
<profiles>

version.adoc.template

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)