2025-01-20 11:17:48 -08:00

72 lines
2.7 KiB
YAML

name: Build
on: [push, pull_request, workflow_dispatch]
jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
cache: "gradle"
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Compile JavaScript
run: ./gradlew generateJavaScript
- name: Compile assets
run: bash ./CompileEPK.sh
- name: Generate offline download
if: github.ref != 'refs/heads/main'
run: bash ./MakeOfflineDownload.sh
- name: Generate signed client
if: github.ref == 'refs/heads/main'
run: source ./SIGNED_CLIENT.env && echo -e "${{ vars.SIGNED_CLIENT_INPUT }}${{ secrets.SIGNED_CLIENT_SECRET }}" | bash ./MakeSignedClient.sh
- name: Prepare files - standard
if: github.ref != 'refs/heads/main'
run: |
mkdir -p ${{ runner.temp }}/gh-pages
cp -t ${{ runner.temp }}/gh-pages \
javascript/assets.epk \
javascript/classes.js \
javascript/classes.js.map \
javascript/favicon.png \
javascript/index.html
cp javascript/Starlike_Client_Offline.html ${{ runner.temp }}/gh-pages/offline.html
- name: Prepare files - signed
if: github.ref == 'refs/heads/main'
run: |
mkdir -p ${{ runner.temp }}/gh-pages
cp -t ${{ runner.temp }}/gh-pages \
javascript/assets.epk \
javascript/classes.js \
javascript/classes.js.map \
javascript/favicon.png \
javascript/index.html
cp javascript/Starlike_Client_Offline_Signed.html ${{ runner.temp }}/gh-pages/offline.html
cp javascript/Starlike_Client_Offline_Signed.html.dat ${{ runner.temp }}/gh-pages/latest_update.dat
- name: Upload web files
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: web_files
path: ${{ runner.temp }}/gh-pages
retention-days: 1
compression-level: 9
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ runner.temp }}/gh-pages
cname: starlike.orionzleon.me
force_orphan: true
user_name: 'github-actions[bot]'
user_email: '41898282+github-actions[bot]@users.noreply.github.com'
commit_message: 'github-actions: deploy'