add github workflow to automate exe #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Workflow | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' # Optional, you can choose other JDK providers (e.g., zulu) | |
java-version: '17' | |
- name: Build with Maven | |
run: mvn package | |
- name: Create EXE using Launch4j | |
run: | | |
curl -L https://github.com/launch4j/launch4j/releases/download/3.14/launch4j-3.14-win32.msi --output launch4j.msi | |
msiexec /i launch4j.msi /quiet | |
launch4j --output target/MDCstudentSIMULATOR.exe --jar target/gs-maven-0.1.0.jar --outfile target/MDCstudentSIMULATOR.exe | |
shell: bash | |
- name: Upload EXE artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app_executable | |
path: target/MDCstudentSIMULATOR.exe | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: "Release ${{ github.ref_name }}" | |
body: "Release created by GitHub Actions" | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: target/MDCstudentSIMULATOR.exe | |
asset_name: MDCstudentSIMULATOR.exe | |
asset_content_type: application/octet-stream |