Launcher/.github/workflows/push.yml

83 lines
2.6 KiB
YAML
Raw Normal View History

2020-03-31 17:43:36 +03:00
name: push
2021-09-01 00:25:40 +03:00
on: push
2020-03-31 17:43:36 +03:00
jobs:
launcher:
name: Launcher
runs-on: ubuntu-latest
steps:
2020-04-05 10:27:04 +03:00
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
2020-03-31 17:43:36 +03:00
2020-04-05 10:27:04 +03:00
- name: Cache Gradle
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: gravit-${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-launcher
2020-03-31 17:43:36 +03:00
2020-04-05 10:27:04 +03:00
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
2020-03-31 17:43:36 +03:00
2020-04-05 10:27:04 +03:00
- name: Grant execute permission for gradlew
run: chmod +x gradlew
2020-03-31 17:43:36 +03:00
2020-04-05 10:27:04 +03:00
- name: Build with Gradle
run: ./gradlew build
2020-04-05 10:27:04 +03:00
- name: Create artifacts
run: |
mkdir -p artifacts/modules
cd LaunchServer/build/libs/
zip -r -9 ../../../artifacts/libraries.zip * -x "LaunchServer.jar" -x "LaunchServer-clean.jar"
cp LaunchServer.jar ../../../artifacts/LaunchServer.jar
cd ../../../ServerWrapper/build/libs
cp ServerWrapper.jar ../../../artifacts/ServerWrapper.jar
cd ../../../LauncherAuthlib/build/libs
cp LauncherAuthlib.jar ../../../artifacts/LauncherAuthlib.jar
cd ../../../
2020-05-01 04:58:50 +03:00
cp modules/*_module/build/libs/*.jar artifacts/modules || true
cp modules/*_swmodule/build/libs/*.jar artifacts/modules || true
cp modules/*_lmodule/build/libs/*.jar artifacts/modules || true
2020-04-05 10:27:04 +03:00
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: Launcher
path: artifacts
2021-09-01 00:25:40 +03:00
- name: Get version value, set to env
if: startsWith(github.event.ref, 'refs/tags')
run: echo "LAUNCHER_VERSION=v$(awk -F\' '/version =/ {print $2}' build.gradle)" >> $GITHUB_ENV
2020-04-05 10:27:04 +03:00
- name: Create release
id: create_release
uses: actions/create-release@v1
2021-09-01 00:25:40 +03:00
if: startsWith(github.event.ref, 'refs/tags')
2020-04-05 10:27:04 +03:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
2021-09-01 00:25:40 +03:00
release_name: GravitLauncher ${{ env.LAUNCHER_VERSION }}
2020-04-05 10:27:04 +03:00
draft: false
prerelease: false
2020-04-05 10:27:04 +03:00
- name: Pack release
2021-09-01 00:25:40 +03:00
if: startsWith(github.event.ref, 'refs/tags')
2020-04-05 10:27:04 +03:00
run: |
cd artifacts/
zip -r -9 ../Release.zip *
2020-04-05 10:27:04 +03:00
- name: Upload release
2021-09-01 00:25:40 +03:00
if: startsWith(github.event.ref, 'refs/tags')
2020-04-05 10:27:04 +03:00
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Release.zip
asset_name: Release.zip
asset_content_type: application/zip