Skip to content

Commit

Permalink
GHA workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
bladecoder committed Feb 4, 2024
1 parent 38b7788 commit e80719d
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/gradle-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Run Gradle build on push

on: [ push ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
- name: Build with Gradle
run: ./gradlew build
- name: Pass tests and checks
run: ./gradlew check
72 changes: 72 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Upload Release Asset

on:
release:
types: [published]

jobs:
create-release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [ linux, windows, macos ]
include:
- build: linux
os: ubuntu-latest
exec: theintercept
platform: x86_64-linux
- build: macos
os: macos-latest
exec: theintercept.app
platform: x86_64-macos
- build: windows
os: windows-latest
exec: theintercept
platform: x86_64-windows

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
- name: Build package
run: |
VERSION=${{ github.event.release.tag_name}}
VERSION=${VERSION:1 }
# replace version property in inkplayer.properties
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' -e "s/version=.*/version=$VERSION/" assets/inkplayer.properties
else
sed -i -e "s/version=.*/version=$VERSION/" assets/inkplayer.properties
fi
./gradlew lwjgl3:jpackageImage
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
echo "${{ secrets.KEYSTORE }}" | base64 --decode > $HOME/keystore.jks
VERSION_CODE=$((`echo $VERSION | cut -d. -f1` * 100 + `echo $VERSION | cut -d. -f2`))
./gradlew -Pkeystore=$HOME/keystore.jks -PstorePassword=${{ secrets.KEYSTORE_PASSWORD }} -Palias=${{ secrets.KEYALIAS }} -PkeyPassword=${{ secrets.KEY_PASSWORD }} android:assembleRelease -Pversion=$VERSION -PversionCode=$VERSION_CODE
fi
shell: bash
- name: Upload app image to Github release
run: |
staging="theintercept-${{github.event.release.tag_name}}-${{ matrix.platform }}"
mkdir "$staging"
cp -r lwjgl3/build/jpackage/${{ matrix.exec }} "$staging/"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a "$staging.zip" "$staging"
gh release upload ${{github.event.release.tag_name}} "$staging.zip"
else
tar czf "$staging.tar.gz" "$staging"
gh release upload ${{github.event.release.tag_name}} "$staging.tar.gz"
# Upload Android app if ubuntu-latest
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
staging="theintercept-${{github.event.release.tag_name}}"
mv android/build/outputs/apk/release/android-release.apk "android/build/outputs/apk/release/theintercept-${{github.event.release.tag_name}}.apk"
gh release upload ${{github.event.release.tag_name}} "android/build/outputs/apk/release/theintercept-${{github.event.release.tag_name}}.apk"
fi
fi
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
shell: bash

0 comments on commit e80719d

Please sign in to comment.