Skip to content

Commit

Permalink
Merge pull request #414 from ZihengSun/master
Browse files Browse the repository at this point in the history
enable auto release
  • Loading branch information
ZihengSun authored Oct 23, 2023
2 parents 716ce0c + f607cb6 commit f4462c0
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 2 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Build and Publish Geoweaver App

on:
release:
types:
- published
tags:
- '*'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'

- name: Build with Maven
run: mvn clean install -DskipTests

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

- name: Extract version from pom.xml
run: |
VERSION=$(xmllint --xpath "/*[local-name()='project']/*[local-name()='version']/text()" $GITHUB_WORKSPACE/pom.xml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Append version to DEBIAN/control
run: |
echo "Version: ${{ env.VERSION }}" >> $GITHUB_WORKSPACE/linux-deployment/DEBIAN/control
- name: Set execute permissions for postinst script
run: chmod 755 $GITHUB_WORKSPACE/linux-deployment/DEBIAN/postinst

- name: Copy geoweaver.jar to linux-deployment directory
run: cp $GITHUB_WORKSPACE/target/geoweaver.jar $GITHUB_WORKSPACE/linux-deployment/usr/local/bin/

- name: Make geoweaver.sh executable
run: chmod +x $GITHUB_WORKSPACE/linux-deployment/usr/local/bin/geoweaver.sh

- name: Build deb package
run: |
cd $GITHUB_WORKSPACE/linux-deployment
dpkg-deb --build . geoweaver.deb
- name: Upload Geoweaver Artifacts
uses: actions/upload-artifact@v2
with:
name: geoweaver-artifacts
path: |
target/*.jar
pom.xml
linux-deployment/*.deb
release:
needs: build
runs-on: ubuntu-latest

steps:
- name: Install XML parsing tools
run: sudo apt install libxml2-utils

- name: Install jq
run: sudo apt-get install jq

- name: Download Geoweaver Artifacts
uses: actions/download-artifact@v2
with:
name: geoweaver-artifacts

- name: Get ID and upload URL of the latest release
run: |
RESPONSE=$(curl -s -H "Authorization: token ${{ secrets.PAT }}" "https://api.github.com/repos/${{ github.repository }}/releases/latest")
UPLOAD_URL=$(echo "$RESPONSE" | jq -r .upload_url)
RELEASE_ID=$(echo "$RESPONSE" | jq -r .id)
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV
- name: Set release title to version
run: |
curl -X PATCH \
-H "Authorization: token ${{ secrets.PAT }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }} \
-d '{"name": "${{ env.VERSION }}"}'
- name: Upload JAR Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: /home/runner/work/geoweaver-deployment-test/geoweaver-deployment-test/target/geoweaver.jar
asset_name: geoweaver.jar
asset_content_type: application/java-archive
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Upload DEB Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: /home/runner/work/geoweaver-deployment-test/geoweaver-deployment-test/linux-deployment/geoweaver.deb
asset_name: geoweaver.deb
asset_content_type: application/vnd.debian.binary-package
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
5 changes: 5 additions & 0 deletions linux-deployment/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Package: geoweaver
Architecture: all
Maintainer: Geoweaver team <[email protected]>
Description: Geoweaver
Depends: openjdk-11-jre
4 changes: 4 additions & 0 deletions linux-deployment/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -e
update-desktop-database

Binary file added linux-deployment/usr/local/bin/geoweaver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions linux-deployment/usr/local/bin/geoweaver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
java -jar /usr/local/bin/geoweaver.jar &
SERVER_PID=$!

# Wait for the server to start (adjust the time as needed)
sleep 7

# Open the URL in the default web browser
xdg-open http://localhost:8070/Geoweaver

# Wait for the server to complete before exiting
wait $SERVER_PID
9 changes: 9 additions & 0 deletions linux-deployment/usr/share/applications/geoweaver.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Geoweaver
Comment=Geoweaver Application
Exec=/usr/local/bin/geoweaver.sh
Icon=/usr/local/bin/geoweaver.png
Terminal=false
Type=Application
Categories=Utility;

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>com.gw</groupId>
<artifactId>geoweaver</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
<name>geoweaver</name>
<description>A lightweight workflow management software for organizing data analysis workflows,
preserving history of every workflow run, and improving scientist producitvity and workflow FAIRness,
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/js/gw.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edu = {

sponsor: "ESIPLab incubator project, NASA ACCESS project, NSF Geoinformatics project, NSF Cybertraining project",

version: "1.2.1",
version: "1.2.2",

author: "open source contributors",

Expand Down

0 comments on commit f4462c0

Please sign in to comment.