Skip to content

Commit 5842e37

Browse files
committed
feat: CI and packaging
1 parent 6cd7b8b commit 5842e37

File tree

4 files changed

+113
-1
lines changed

4 files changed

+113
-1
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
2+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
3+
4+
name: Gradle Package
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
# release:
11+
# types: [created]
12+
13+
jobs:
14+
build:
15+
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
packages: write
20+
pull-requests: write
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Set up JDK 8
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: '8'
28+
distribution: 'temurin'
29+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
30+
settings-path: ${{ github.workspace }} # location for the settings.xml file
31+
32+
- name: Setup Gradle
33+
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
34+
35+
- name: Build with Gradle
36+
run: ./gradlew :desktop:distTar
37+
38+
- name: Release
39+
id: release
40+
uses: googleapis/release-please-action@v4
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
release-type: simple
44+
45+
- name: Upload Release
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run:
49+
gh release upload ${{ steps.release.outputs.tag_name }} desktop/build/distributions/desktop.tar

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
project.description = 'GeoGebra'
1+
project.description = 'GeoGeobra'
22

33
apply from: 'gradle-scripts/dependencies.gradle'
44

pkg/PKGBUILD

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Maintainer: Mustafa <dev at mstfelg dot com>
2+
3+
pkgname=gsq
4+
pkgdesc="Geogebra-fork focused on extensibility and support for Euclidean Geometry."
5+
pkgver=1.0.0
6+
pkgrel=1
7+
arch=('x86_64') # Adjust according to your package's architecture
8+
url="https://github.com/mstfelg/geosquared"
9+
license=('GPL3' 'CCPL:by-sa' 'CCPL:by-nc') # Adjust the license according to the project
10+
depends=(
11+
'hicolor-icon-theme'
12+
'java-runtime=11'
13+
'xdg-utils'
14+
)
15+
source=("https://github.com/mstfelg/geosquared/archive/refs/tags/v${pkgver}.tar.gz")
16+
sha256sums=('ad044a1baae54f4a6caa9aa3c62402b4627024030a12a2ab97b6201c30d5db59')
17+
18+
package() {
19+
cd "${srcdir}/desktop" || return
20+
install -Dm755 "${srcdir}/bin/desktop" "${pkgdir}/usr/bin/gsq"
21+
install -dm755 "${pkgdir}/usr/share/gsq"
22+
install "lib/"* -t "${pkgdir}/usr/share/gsq/"
23+
}
24+
25+
# Additional functions can be added here if needed

pkg/gsq

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
GG_PATH="/usr/share"
3+
export GG_CONFIG_PATH="${HOME}"
4+
GG_EXECUTABLE="${GG_PATH}/gsq/gsq"
5+
GG_JAVA_VERSION="11"
6+
7+
run_gg() {
8+
exec "${GG_EXECUTABLE}" "$@"
9+
exit 0
10+
}
11+
12+
# check JAVA_HOME first
13+
if test ! -z "${JAVA_HOME}"; then
14+
if test "${JAVA_HOME#*$GG_JAVA_VERSION}" != "${JAVA_HOME}"; then
15+
# system environment variable set to required, do nothing
16+
echo "Using java environment from JAVA_HOME: ${JAVA_HOME}" >&2
17+
run_gg "$@"
18+
else
19+
# unset JAVA_HOME
20+
echo "Unset JAVA_HOME for this run: ${JAVA_HOME}" >&2
21+
unset JAVA_HOME
22+
fi
23+
fi
24+
25+
# check current environment
26+
if archlinux-java status | grep "default" | grep -qw "${GG_JAVA_VERSION}"; then
27+
# required java version is set to default, do nothing
28+
echo "Using system enabled java environment" >&2
29+
run_gg "$@"
30+
fi
31+
32+
# find valid environment
33+
GG_JAVA_ENV="$(archlinux-java status | grep -w "${GG_JAVA_VERSION}" | awk '{ print $1 }')"
34+
# for some env it returns like java-8-openjdk/jre
35+
GG_JAVA_ENV="${GG_JAVA_ENV%/*}"
36+
export PATH="/usr/lib/jvm/${GG_JAVA_ENV}/bin/:${PATH}"
37+
echo "Run with exported ${GG_JAVA_ENV}" >&2
38+
run_gg "$@"

0 commit comments

Comments
 (0)