diff --git a/.github/workflows/generate_release.yml b/.github/workflows/generate_release.yml new file mode 100644 index 0000000..8991936 --- /dev/null +++ b/.github/workflows/generate_release.yml @@ -0,0 +1,56 @@ +name: Generate Release + +on: + workflow_dispatch: + +jobs: + generate-release: + runs-on: ubuntu-latest + env: + Output_Dir: ${{ github.workspace }}/out + Version: snapshot + + steps: + - 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 + + - 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 + 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 + uses: robinraju/release-downloader@v1.7 + with: + repository: "Ecdar/Reveaal" + latest: true + fileName: "Reveaal*" + out-file-path: "Ecdar-GUI/lib/" + + - name: Generate Distributions + 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: $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