Skip to content

Build HMCL

Build HMCL #13

Workflow file for this run

name: Build HMCL
on:
workflow_dispatch:
schedule:
- cron: '0 0 */1 * *'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout current repository
uses: actions/checkout@v4
- name: Checkout HMCL Repository
uses: actions/checkout@v4
with:
repository: 'HMCL-dev/HMCL'
path: 'hmcl-source'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
java-package: 'jdk+fx'
- name: Modify Files
run: |
sed -i 's/static final BooleanProperty RESTRICTED = new SimpleBooleanProperty(true);/static final BooleanProperty RESTRICTED = new SimpleBooleanProperty(false);/' hmcl-source/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountListPage.java
sed -i 's/unofficial-\$shortCommit/unofficial/g' hmcl-source/HMCL/build.gradle.kts
shell: bash
- name: Grant execute permission for gradlew
run: chmod +x hmcl-source/gradlew
shell: bash
- name: Build with Gradle
run: |
cd hmcl-source
./gradlew build
shell: bash
- name: Packaging for Linux
run: |
cd hmcl-source/HMCL/build/libs/
cp ${{ github.workspace }}/assets/HMCL/icon.png .
tar -czvf hmcl-linux.tar.gz *.sh icon.png
shell: bash
- name: Delete
uses: andreaswilli/delete-release-assets-action@v4.0.0
with:
github_token: ${{ secrets.USER_TOKEN }}
tag: HMCL
deleteOnlyFromDrafts: false
continue-on-error: true
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
hmcl-source/HMCL/build/libs/*.sh
hmcl-source/HMCL/build/libs/*.exe
hmcl-source/HMCL/build/libs/*.jar
hmcl-source/HMCL/build/libs/hmcl-linux.tar.gz
tag_name: HMCL
prerelease: false
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}