Skip to content

Commit

Permalink
🏷 Define JAR version procedurally.
Browse files Browse the repository at this point in the history
  • Loading branch information
warrenseine committed Jul 9, 2020
1 parent 003742b commit ba43bef
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ jobs:
with:
path: artifacts
- name: Merge artifacts
id: merge
run: |
rm -rf tmp JVips.jar
mkdir tmp
(cd tmp; unzip -uo ../artifacts/jar-macos/JVips.jar)
(cd tmp; unzip -uo ../artifacts/jar-linux-windows/JVips.jar)
jar -cvf JVips.jar -C tmp .
(cd tmp; for jar in ../artifacts/*/JVips.jar; do unzip -uo $jar; done)
jar -cvMf JVips.jar -C tmp .
echo ::set-output name=jar_version::$(grep 'Implementation-Version' tmp/META-INF/MANIFEST.MF | cut -d ':' -f2)
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -66,8 +68,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: latest
release_name: Latest
tag_name: ${{ steps.merge.outputs.jar_version }}
release_name: ${{ steps.merge.outputs.jar_version }}
draft: false
prerelease: false
- name: Upload release asset
Expand Down
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@ if [ ${BUILD_MACOS} -gt 0 ]; then
popd
fi

source lib/variables.sh
VERSION="$VIPS_VERSION-$(git rev-parse --short HEAD)"

mvn ${MAVEN_ARGS} -DnewVersion=$VERSION versions:set
mvn ${MAVEN_ARGS} -DskipTests clean package
mvn ${MAVEN_ARGS} versions:revert

if [ ${RUN_TEST} -gt 0 ]; then
mvn ${MAVEN_ARGS} surefire:test@utest
Expand Down
12 changes: 11 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>JVips</groupId>
<artifactId>JVips</artifactId>
<version>1.0.1</version>
<version>0.0.0-SNAPSHOT</version>
<profiles>
<profile>
<id>all</id>
Expand Down Expand Up @@ -73,8 +73,18 @@
<configuration>
<outputDirectory>${project.basedir}</outputDirectory>
<finalName>JVips</finalName>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down

0 comments on commit ba43bef

Please sign in to comment.