-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/ZihengSun/Geoweaver
- Loading branch information
Showing
6 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
set -e | ||
update-desktop-database | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|