Skip to content

Commit e8b3df1

Browse files
committed
fix: updated automate releases
1 parent 633ca86 commit e8b3df1

File tree

4 files changed

+83
-53
lines changed

4 files changed

+83
-53
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
matrix:
1616
# 7.0.0-SNAPSHOT and 6.2.1 created
1717
exist-version: [latest, release]
18-
java-version: [11, 17]
18+
java-version: [11, 21]
1919
exclude:
2020
- exist-version: release
21-
java-version: 17
21+
java-version: 21
2222
- exist-version: latest
2323
java-version: 11
2424

@@ -42,7 +42,7 @@ jobs:
4242
with:
4343
distribution: 'temurin'
4444
java-version: ${{ matrix.java-version }}
45-
- run: ant
45+
- run: ant -Dapp.version=1.0.0-SNAPSHOT
4646

4747
# Install
4848
- name: Start exist-ci containers
@@ -60,6 +60,12 @@ jobs:
6060
- name: lint commit message
6161
uses: wagoid/commitlint-github-action@v6
6262

63+
lastmod:
64+
uses: HistoryAtState/ci-actions/.github/workflows/last-mod.yml@v1
65+
if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }}
66+
needs: build
67+
secrets: inherit
68+
6369
release:
6470
name: Release
6571
runs-on: ubuntu-latest

.releaserc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"preset": "conventionalcommits"
1111
},
1212
["@semantic-release/exec", {
13-
"prepareCmd": "ant -Dapp.version=${nextRelease.version}"
13+
"prepareCmd": "ant -Dapp.version=${nextRelease.version} -Drelease=true"
1414
}],
1515
["@semantic-release/git", {
1616
"assets": ["expath-pkg.xml", "repo.xml"],

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Source data for [Conferences](https://history.state.gov/conferences)
1818
ant -Dapp.version=X.X.X
1919
```
2020

21+
During a release the property `-Drelease=true` must be set for proper processing of template files.
22+
2123
## Release
2224

2325
Releases for this data package are automated. Any commit to the `master`` branch will trigger the release automation.

build.xml

Lines changed: 71 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,98 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project default="xar" name="conferences" basedir=".">
3-
<xmlproperty file="build.properties.xml" semanticAttributes="true" keepRoot="false"/>
4-
<property name="build.dir" value="build"/>
5-
<property name="git.repo.path" value="${basedir}/.git"/>
6-
<available file="${git.repo.path}" type="dir" property="git.present"/>
3+
<xmlproperty file="build.properties.xml" semanticAttributes="true" keepRoot="false" />
4+
<property name="build.dir" value="build" />
5+
<property name="git.repo.path" value="${basedir}/.git" />
6+
<available file="${git.repo.path}" type="dir" property="git.present" />
7+
8+
<condition property="is-release">
9+
<equals arg1="${release}" arg2="true" />
10+
</condition>
11+
12+
<target name="release.true" if="is-release">
13+
<echo>Calculating git revision info for release</echo>
14+
</target>
15+
16+
<target name="release.false" unless="is-release">
17+
<echo>Not a release, moving on ...</echo>
18+
</target>
19+
20+
<target name="check-release" depends="release.true, release.false">
21+
</target>
722

823
<target name="clean">
9-
<echo message="Deleting xar files..."/>
10-
<delete dir="${build.dir}" failonerror="false"/>
11-
<delete file="${basedir}/expath-pkg.xml" failonerror="false"/>
12-
<delete file="${basedir}/repo.xml" failonerror="false"/>
24+
<echo message="Deleting xar files..." />
25+
<delete dir="${build.dir}" failonerror="false" />
1326
</target>
14-
15-
<target name="xar" depends="clean,git.revision" description="create xar file">
16-
<echo message="Creating build folder..."/>
17-
<mkdir dir="${build.dir}"/>
1827

19-
<echo message="Apply values to expath-pkg.xml..."/>
28+
<target name="templates" description="process template files" if="is-release"
29+
depends="git.revision">
30+
<echo message="Apply values to .tmpl ..." />
2031
<copy todir="${basedir}" overwrite="true" verbose="true">
21-
<fileset file="*.xml.tmpl"/>
32+
<fileset file="*.xml.tmpl" />
2233
<filterchain>
2334
<replacetokens>
24-
<token key="name" value="${app.name}"/>
25-
<token key="version" value="${app.version}"/>
26-
<token key="url" value="${app.url}"/>
27-
<token key="title" value="${app.title}"/>
28-
<token key="commit-id" value="${git.revision}"/>
29-
<token key="commit-time" value="${git.time}"/>
35+
<token key="name" value="${app.name}" />
36+
<token key="version" value="${app.version}" />
37+
<token key="url" value="${app.url}" />
38+
<token key="title" value="${app.title}" />
39+
<token key="commit-id" value="${git.revision}" />
40+
<token key="commit-time" value="${git.time}" />
3041
</replacetokens>
3142
<tokenfilter>
32-
<!-- until we move template processing to XSLT, take care with reserved characters -->
33-
<replacestring from="&amp;" to="&amp;amp;"/>
43+
<!-- until we move template processing to XSLT, take care with reserved
44+
characters -->
45+
<replacestring from="&amp;" to="&amp;amp;" />
3446
</tokenfilter>
3547
</filterchain>
36-
<globmapper from="*.tmpl" to="*"/>
48+
<globmapper from="*.tmpl" to="*" />
3749
</copy>
50+
</target>
51+
52+
<target name="xar" depends="clean,check-release,git.revision,templates"
53+
description="create xar file">
54+
<echo message="Creating build folder..." />
55+
<mkdir dir="${build.dir}" />
56+
57+
<echo message="------------------------------------------------------------" />
58+
<echo message="Creating xar file..." />
59+
<echo message="------------------------------------------------------------" />
3860

39-
<echo message="------------------------------------------------------------"/>
40-
<echo message="Creating xar file..."/>
41-
<echo message="------------------------------------------------------------"/>
42-
4361
<zip basedir="${basedir}" destfile="${build.dir}/${app.name}.xar">
44-
<exclude name="${build.dir}/**"/>
45-
<exclude name="*.tmpl"/>
46-
<exclude name=".github/**"/>
47-
<exclude name="test/**"/>
48-
<exclude name="node_modules/**"/>
62+
<exclude name="${build.dir}/**" />
63+
<exclude name="*.tmpl" />
64+
<exclude name=".github/**" />
65+
<exclude name="test/**" />
66+
<exclude name="node_modules/**" />
4967
</zip>
50-
<echo>Version: ${app.version}</echo>
68+
<echo>Version: ${app.version}</echo>
5169
</target>
5270

53-
<target name="git.revision" description="Store git revision in ${repository.version}" if="git.present">
54-
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
55-
<arg value="--git-dir=${git.repo.path}"/>
56-
<arg value="rev-parse"/>
57-
<arg value="HEAD"/>
71+
<target name="git.revision" description="Store git revision in ${repository.version}"
72+
if="is-release" depends="check-release">
73+
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false"
74+
errorproperty="">
75+
<arg value="--git-dir=${git.repo.path}" />
76+
<arg value="rev-parse" />
77+
<arg value="HEAD" />
5878
</exec>
5979
<condition property="repository.version" value="${git.revision}" else="unknown">
6080
<and>
61-
<isset property="git.revision"/>
62-
<length string="${git.revision}" trim="yes" length="0" when="greater"/>
81+
<isset property="git.revision" />
82+
<length string="${git.revision}" trim="yes" length="0" when="greater" />
6383
</and>
6484
</condition>
6585
<echo>Git repo: ${repository.version}</echo>
66-
67-
<exec executable="git" outputproperty="git.time" failifexecutionfails="false" errorproperty="">
68-
<arg value="--git-dir=${git.repo.path}"/>
69-
<arg value="show"/>
70-
<arg value="-s"/>
71-
<arg value="--format=%ct"/>
72-
<arg value="${git.revision}"/>
86+
87+
<exec executable="git" outputproperty="git.time" failifexecutionfails="false"
88+
errorproperty="">
89+
<arg value="--git-dir=${git.repo.path}" />
90+
<arg value="show" />
91+
<arg value="-s" />
92+
<arg value="--format=%ct" />
93+
<arg value="${git.revision}" />
7394
</exec>
7495
<echo>Git time: ${git.time}</echo>
75-
</target>
76-
</project>
96+
97+
</target>
98+
</project>

0 commit comments

Comments
 (0)