Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub action for automatizing shup release with openWebStart configu… #2232

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/release_shup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Java CI to create and upload Shanoir Uploader release on pull request
on:
push:
branches: [ "master" ]
paths:
- 'shanoir-uploader/**'
pull_request:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @LaurentPV, I wonder, if we should do something on each pull request or only, when something goes on master? I think even with each new integration into master, we will not release a new version of ShUp. I think it would be interesting for each push into master to create a new "timestamp" in RELEASE_DATE on ShUpConfig.
I think the process of having a new version, as today the tags for the prod release by Anthony are driven by a human decision, not by an integration on master. With kind regards, Michael

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will add a new commit modifying the RELEASE_DATE constant with the timestamp of the push on master branch.
Do you mean that the tag of the release should be the release_date instead of the release_version ?
It seems weird not to have the tag of a version linked to a release but in the same time it would be more convenient because it assures the uniqueness of each release tag. For now if you forget to modify the version in the pom.xml before pushing into master the release will fail because the previous release exists already.

branches: [ "master" ]
paths:
- 'shanoir-uploader/**'

env:
build-number: ${GITHUB_RUN_NUMBER}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Install libxml2-utils
run: sudo apt-get update && sudo apt-get install -y libxml2-utils

- name: Extract Project Version
id: get_version
run: |
VERSION=$(xmllint --xpath "/*[local-name()='project']/*[local-name()='version']/text()" shanoir-uploader/pom.xml)
echo ::set-output name=version::$VERSION

- name: Decode and write keystore
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > shanoir-uploader/keystore.jks

- name: Build shanoir-ng with Maven
run: mvn -f shanoir-ng-parent/pom.xml clean install -DskipTests
env:
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}


- name: Build shanoir-uploader with Maven
run: mvn -f shanoir-uploader/pom.xml package -DskipSigning=false
env:
MAVEN_OPTS: "-Djavax.net.ssl.trustStore=shanoir-uploader/keystore.jks -Djavax.net.ssl.trustStorePassword=${{ secrets.KEYSTORE_PASS }}"
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.version }}
release_name: 'Release ${{ steps.get_version.outputs.version }}'
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: shanoir-uploader/target/shanoir-uploader-${{ steps.get_version.outputs.version }}-jar-with-dependencies.jar
asset_name: shanoir-uploader-${{ steps.get_version.outputs.version }}-jar-with-dependencies.jar
asset_content_type: application/java-archive

- name: Upload JNLP Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: shanoir-uploader/target/ShanoirUploader.jnlp
asset_name: ShanoirUploader.jnlp
asset_content_type: application/x-java-jnlp-file
18 changes: 18 additions & 0 deletions shanoir-uploader/ShanoirUploader.jnlp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="https://github.com/fli-iam/shanoir-ng/releases/latest/download/" href="ShanoirUploader.jnlp">
<information>
<title>Shanoir Uploader</title>
LaurentPV marked this conversation as resolved.
Show resolved Hide resolved
<vendor>Empenn Team - Inria</vendor>
<homepage href="https://project.inria.fr/shanoir/" />
<description>Desktop client for the Shanoir server</description>
<icon href="https://raw.githubusercontent.com/fli-iam/shanoir-ng/master/shanoir-uploader/src/main/resources/images/simpleLogo.64x64.png"/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="17+" />
<jar href="shanoir-uploader-${project.version}-jar-with-dependencies.jar" />
</resources>
<application-desc main-class="org.shanoir.uploader.ShanoirUploader" />
</jnlp>
47 changes: 46 additions & 1 deletion shanoir-uploader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<junit.jupiter.version>5.8.2</junit.jupiter.version>
<junit.platform.version>1.8.2</junit.platform.version>
<poi.version>4.1.2</poi.version>
<skipSigning>true</skipSigning>
</properties>

<dependencies>
Expand Down Expand Up @@ -295,13 +296,14 @@
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<phase>prepare-package</phase>
<configuration>
<tasks>
<copy file="start-shup-windows-java.bat" tofile="target/start-shup-windows-java.bat" />
<copy file="start-shup-linux-mac-java.sh" tofile="target/start-shup-linux-mac-java.sh" />
<copy file="downloadDataset.sh" tofile="target/downloadDataset.sh" />
<copy file="downloadDataset.bat" tofile="target/downloadDataset.bat" />
<copy file="${project.basedir}/ShanoirUploader.jnlp" todir="${project.build.directory}" />
</tasks>
</configuration>
<goals>
Expand All @@ -310,6 +312,28 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>${project.build.directory}/ShanoirUploader.jnlp</file>
<replacements>
<replacement>
<token>\$\{project.version\}</token>
<value>${project.version}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
Expand Down Expand Up @@ -352,6 +376,27 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>signer</id>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<skip>${skipSigning}</skip>
<archive>${project.build.directory}/shanoir-uploader-${project.version}-jar-with-dependencies.jar</archive>
<keystore>${project.basedir}/keystore.jks</keystore>
<storepass>${env.KEYSTORE_PASS}</storepass>
<keypass>${env.KEYSTORE_PASS}</keypass>
<alias>${env.KEY_ALIAS}</alias>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading