From 1cf130e82254760699897f07abe6e8f9cc4988af Mon Sep 17 00:00:00 2001 From: "Niels F. S. Vistisen" <42961494+Nielswps@users.noreply.github.com> Date: Sat, 28 Jan 2023 17:22:28 +0100 Subject: [PATCH 1/2] Create generate_release.yml --- .github/workflows/generate_release.yml | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/generate_release.yml diff --git a/.github/workflows/generate_release.yml b/.github/workflows/generate_release.yml new file mode 100644 index 0000000..775ac54 --- /dev/null +++ b/.github/workflows/generate_release.yml @@ -0,0 +1,47 @@ +name: Generate Release + +on: + workflow_dispatch: + +jobs: + generate-release: + runs-on: ubuntu-latest + steps: + # Recursively checkout all dependencies + - name: Checkout project sources + uses: actions/checkout@v3 + with: + submodules: recursive + env: + GUI_Dir: ${{ github.workspace }}/Ecdar-GUI + ECDAR_Dir: ${{ github.workspace }} + Version: snapshot + + + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + java-package: jdk + + - name: Cache Gradle packages + uses: actions/cache@v1 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + + - name: Download j-Ecdar + run: . # ToDo clone into $Ecdar-Dir/lib + + - name: Download Reveaal + run: . # ToDo clone into $Ecdar-Dir/lib + + - name: Generate Distributions + run: ./$Ecdar-Dir/*.sh + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v3.1.2 + with: + name: $Version + path: $ECDAR_Dir # ToDO: Set path to the resulting From 2fa095613941929609766d5430169741f9ec0d47 Mon Sep 17 00:00:00 2001 From: Niels Vistisen Date: Sun, 29 Jan 2023 11:49:43 +0100 Subject: [PATCH 2/2] WIP: First draft of workflow finished and script updated --- .github/workflows/generate_release.yml | 43 ++++++++++++++++---------- generate_distributable.sh | 22 +++++++++++-- 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/.github/workflows/generate_release.yml b/.github/workflows/generate_release.yml index 775ac54..8991936 100644 --- a/.github/workflows/generate_release.yml +++ b/.github/workflows/generate_release.yml @@ -6,23 +6,20 @@ on: jobs: generate-release: runs-on: ubuntu-latest + env: + Output_Dir: ${{ github.workspace }}/out + Version: snapshot + steps: - # Recursively checkout all dependencies - - name: Checkout project sources + - name: Checkout Ecdar/ECDAR Sources + uses: actions/checkout@v3 + + - name: Checkout Ecdar/Ecdar-GUI Sources uses: actions/checkout@v3 with: + name: Ecdar/Ecdar-GUI + path: Ecdar-GUI submodules: recursive - env: - GUI_Dir: ${{ github.workspace }}/Ecdar-GUI - ECDAR_Dir: ${{ github.workspace }} - Version: snapshot - - - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - java-package: jdk - name: Cache Gradle packages uses: actions/cache@v1 @@ -32,16 +29,28 @@ jobs: restore-keys: ${{ runner.os }}-gradle - name: Download j-Ecdar - run: . # ToDo clone into $Ecdar-Dir/lib + uses: robinraju/release-downloader@v1.7 + with: + repository: "Ecdar/j-Ecdar" + latest: true + fileName: "j-Ecdar*" + out-file-path: "Ecdar-GUI/lib/" - name: Download Reveaal - run: . # ToDo clone into $Ecdar-Dir/lib + uses: robinraju/release-downloader@v1.7 + with: + repository: "Ecdar/Reveaal" + latest: true + fileName: "Reveaal*" + out-file-path: "Ecdar-GUI/lib/" - name: Generate Distributions - run: ./$Ecdar-Dir/*.sh + run: | + cd ${{ github.workspace }}/Ecdar-GUI + ./${{ github.workspace }}/*.sh -v $Version -o $Output_Dir - name: Upload a Build Artifact uses: actions/upload-artifact@v3.1.2 with: name: $Version - path: $ECDAR_Dir # ToDO: Set path to the resulting + path: $Output_Dir diff --git a/generate_distributable.sh b/generate_distributable.sh index 7aec12b..6a287f0 100755 --- a/generate_distributable.sh +++ b/generate_distributable.sh @@ -1,10 +1,26 @@ #!/bin/bash -read -p "The version of this release: " version +while getopts v:o: flag +do + case "${flag}" in + v) version=${OPTARG};; + o) output_dir=${OPTARG};; + esac +done + +if [ $version="" ]; then + version="snapshot" +fi + +if [ $output_dir="" ]; then + output_dir="${HOME}/Documents" +fi target_name="ecdar-${version}" version_file="src/main/resources/ecdar/version" +echo "Generating platform specific distributions of ${target_name} in ${output_dir}" + if [ -f $version_file ]; then echo "version: ${version}" > $version_file else @@ -14,7 +30,7 @@ fi # Generate distributable zip file with specified version ./gradlew clean # Clean build directory to prevent multiple .zip files from interfering with script -./gradlew -PecdarVersion=${version} distZip +./gradlew -PecdarVersion=$version distZip # Create temporary directory TEMPD=$(mktemp -d) @@ -62,6 +78,6 @@ chmod u+x $TEMPD/*/lib/Reveaal chmod u+x $TEMPD/*/lib/Reveaal.exe # Clear target directory and copy the contents of the temporary directory to target -dest="${HOME}/Documents/${target_name}" +dest="$output_dir/${target_name}" rm -r $dest &>/dev/null; mkdir $dest cp -r $TEMPD/*/* $dest