fix workflow #4
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' | |
java-version: '17' | |
- name: Build with Maven | |
run: mvn package | |
- name: Install Launch4j using Chocolatey | |
run: | | |
choco install launch4j -y | |
- name: Find Launch4j Path and Run | |
run: | | |
launch4jPath=$(choco list --local-only launch4j | grep "launch4j" | awk '{print $3}') | |
echo "Launch4j installed version: $launch4jPath" | |
launch4jExecutable="C:\ProgramData\chocolatey\lib\launch4j.$launch4jPath\tools\launch4j.exe" | |
echo "Using Launch4j executable at: $launch4jExecutable" | |
$launch4jExecutable launch4j.xml | |
shell: bash | |
- name: Upload EXE artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: MDCstudentSIMULATOR_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 |