Skip to content

Commit

Permalink
[GHA] Enhance tagging release system
Browse files Browse the repository at this point in the history
+ Add metadata auto generated within config.ini - Fix #115
+ Set embedded JDK as workflow parameter - Easier to set and upgrade embedded JDK
+ Make Package tagging snapshot dependent - If a snapshot, keep the OSGi SNAPSHOT tag and publish p2 to updates.gama-platform.org/0.0.0
  • Loading branch information
RoiArthurB committed Mar 13, 2024
1 parent ffd0ce9 commit 94fdde0
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/travis-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ on:
type: string
required: false
default: "2024.03.0"
jdk_embedded_version:
type: string
required: false
secrets:
GAMA_KEYSTORE_BASE64:
required: false
Expand Down Expand Up @@ -63,6 +66,8 @@ jobs:
if: "${{ inputs.get_all_archives_for_release }}"
run: |
bash $GITHUB_WORKSPACE/travis/bumpGamaVersion.sh ${{ inputs.new_release_tag }}
env:
JDK_EMBEDDED_VERSION: ${{ inputs.jdk_embedded_version }}

- name: Import & Prepare JAR signing
if: "${{ inputs.get_all_archives_for_release }}"
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/travis-packaging-jdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
required: true
default: 2024.03.0
type: string
jdk_embedded_version:
type: string
required: false
secrets:
GAMA_KEYSTORE_BASE64:
required: true
Expand Down Expand Up @@ -45,6 +48,7 @@ jobs:
GAMA_KEYSTORE_BASE64: ${{ secrets.GAMA_KEYSTORE_BASE64 }}
GAMA_KEYSTORE_STOREPASS: ${{ secrets.GAMA_KEYSTORE_STOREPASS }}
RUNNER_TMP: ${{ runner.temp }}
JDK_EMBEDDED_VERSION: ${{ inputs.jdk_embedded_version }}

# cf https://github.com/actions/upload-artifact/issues/246
- name: Move artefacts to root tree
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/trigger-gama-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
type: string
required: true
default: 2024.03.0
jdk:
description: "Choose a JDK version to embed inside GAMA release"
type: string
required: true
default: 17.0.8.1+1

run-name: Building GAMA release

Expand All @@ -24,6 +29,7 @@ jobs:
get_testing_compiled_archives: false
get_all_archives_for_release: true
new_release_tag: ${{ inputs.tag }}
jdk_embedded_version: ${{ inputs.jdk }}
secrets:
GAMA_KEYSTORE_BASE64: ${{ secrets.GAMA_KEYSTORE_BASE64 }}
GAMA_KEYSTORE_STOREPASS: ${{ secrets.GAMA_KEYSTORE_STOREPASS }}
Expand Down Expand Up @@ -73,6 +79,7 @@ jobs:
uses: ./.github/workflows/travis-packaging.yaml
with:
RELEASE_VERSION: ${{ inputs.tag }}
jdk_embedded_version: ${{ inputs.jdk }}
secrets:
# === MacOS needs ===
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
Expand Down
6 changes: 5 additions & 1 deletion gama.product/gama.product
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,12 @@
<plugin id="org.eclipse.equinox.p2.reconciler.dropins" autoStart="true" startLevel="5" />
<plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
<property name="org.eclipse.update.reconcile" value="false" />
<property name="version" value="SNAPSHOT" />
<property name="eclipse.buildId" value="${build.id}" />
<property name="gama.version" value="SNAPSHOT" />
<property name="gama.commit" value="SNAPSHOT" />
<property name="gama.branch" value="SNAPSHOT" />
<property name="gama.date" value="SNAPSHOT" />
<property name="gama.jdk" value="SNAPSHOT" />
</configurations>

<repositories>
Expand Down
42 changes: 33 additions & 9 deletions travis/bumpGamaVersion.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/bin/bash

#
# SCRIPT watchdog
#

# check if 2 param
oldVersion="0.0.0"
inputVersion=$1
isSnapshot=true

if [ $2 != '' ]
isSnapshot=false
fi

month=$(echo $inputVersion | awk -F'.' '{print $2}' | awk '{print int($1)}')
id=$(echo $inputVersion | awk -F'.' '{print $3}' | awk '{print int($1)}')
newVersion=$(echo $inputVersion | awk -F'.' -v month="$month" -v id="$id" '{$2=month; $3=id; print}' | sed 's/\ /\./g') # Remove leading zero(s) after dot character, enforcing OSGi version format
versionToTag=$(echo $inputVersion | awk -F'.' -v month="$month" -v id="$id" '{$2=month; $3=id; print}' | sed 's/\ /\./g') # Remove leading zero(s) after dot character, enforcing OSGi version format

# Set path
path="$( dirname $( realpath "${BASH_SOURCE[0]}" ) )/.."

echo "Tagging GAMA packages release as $newVersion"
echo "[SNAPSHOT: $isSnapshot] Tagging GAMA packages release as $versionToTag"

#
# Should I clean maven ?
Expand All @@ -30,20 +31,32 @@ cd $path/gama.parent && mvn clean -B
#

echo "Update .qualifier"
newVersion=$versionToTag
if [ $isSnapshot ]; then
newVersion="$versionToTag.qualifier"
fi
find $path -type f -name "*.xml" -exec sed -i "s/$oldVersion.qualifier/$newVersion/g" {} \;
find $path -type f -name "*.product" -exec sed -i "s/$oldVersion.qualifier/$newVersion/g" {} \;
find $path -type f -name "*.product" -exec sed -i "s/$oldVersion.qualifier/$versionToTag/g" {} \;
find $path -type f -name "MANIFEST.MF" -exec sed -i "s/$oldVersion.qualifier/$newVersion/g" {} \;

echo "Update -SNAPSHOT"
newVersion=$versionToTag
if [ $isSnapshot ]; then
newVersion="$versionToTag-SNAPSHOT"
fi
find $path -type f -name "*.xml" -exec sed -i "s/$oldVersion-SNAPSHOT/$newVersion/g" {} \;

echo "Finish updating meta-data from .product"
find $path -type f -name "*.product" -exec sed -i "s/$oldVersion-SNAPSHOT/$newVersion/g" {} \;
find $path -type f -name "*.product" -exec sed -i "s/$oldVersion/$newVersion/g" {} \;

echo "Update sites url"
find $path -type f -name "feature.xml" -exec sed -i "s/$oldVersion Update/$newVersion Update/g" {} \;
find $path -type f -name "feature.xml" -exec sed -i "s/org\/$oldVersion/org\/$newVersion/g" {} \;
find $path -type f -name "pom.xml" -exec sed -i "s/$oldVersion<\/url>/$newVersion<\/url>/g" {} \;

if [ ! $isSnapshot ]; then
find $path -type f -name "feature.xml" -exec sed -i "s/org\/$oldVersion/org\/$versionToTag/g" {} \;
find $path -type f -name "pom.xml" -exec sed -i "s/$oldVersion<\/url>/$versionToTag<\/url>/g" {} \;
fi

#
# UPDATING JAVA HEADERS
Expand All @@ -67,3 +80,14 @@ sed -i "s/$oldVersion-SNAPSHOT/$newVersion/g" $path/gama.core/src/gama/core/runt
sed -i "s/$oldVersion-SNAPSHOT/$newVersion/g" $path/gama.annotations/src/gama/annotations/precompiler/doc/utils/Constants.java

sed -i "s/$oldVersion/$newVersion/g" $path/gama.product/extraresources/Info.plist

#
# Meta-Data generator
#

echo "Set GAMA meta-data in config.ini"
sed -i "s/gama.version\" value=\"SNAPSHOT/gama.version\" value=\"$newVersion/g" $path/gama.product/gama.product
sed -i "s/gama.commit\" value=\"SNAPSHOT/gama.commit\" value=\"$(git rev-parse HEAD)/g" $path/gama.product/gama.product
sed -i "s/gama.branch\" value=\"SNAPSHOT/gama.branch\" value=\"$(git rev-parse --abbrev-ref HEAD)/g" $path/gama.product/gama.product
sed -i "s/gama.date\" value=\"SNAPSHOT/gama.date\" value=\"$(date)/g" $path/gama.product/gama.product
sed -i "s/gama.jdk\" value=\"SNAPSHOT/gama.jdk\" value=\"$JDK_EMBEDDED_VERSION/g" $path/gama.product/gama.product
8 changes: 4 additions & 4 deletions travis/zip_withjdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ archivePath="$GITHUB_WORKSPACE/gama.application"
# Download latest JDK
#
echo "=== Download latest JDK"
wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.8.1+1 | grep "/OpenJDK17U-jdk_x64_linux.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_linux-17.tar.gz"
wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.8.1+1 | grep "/OpenJDK17U-jdk_x64_window.*.zip\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_win32-17.zip"
wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.8.1+1 | grep "/OpenJDK17U-jdk_x64_mac.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_macosx-17.tar.gz"
wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.8.1+1 | grep "/OpenJDK17U-jdk_aarch64_mac.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_macosx_aarch-17.tar.gz"
wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-$JDK_EMBEDDED_VERSION | grep "/OpenJDK17U-jdk_x64_linux.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_linux-17.tar.gz"
wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-$JDK_EMBEDDED_VERSION | grep "/OpenJDK17U-jdk_x64_window.*.zip\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_win32-17.zip"
wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-$JDK_EMBEDDED_VERSION | grep "/OpenJDK17U-jdk_x64_mac.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_macosx-17.tar.gz"
wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-$JDK_EMBEDDED_VERSION | grep "/OpenJDK17U-jdk_aarch64_mac.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_macosx_aarch-17.tar.gz"

#
# Prepare downloaded JDK
Expand Down

0 comments on commit 94fdde0

Please sign in to comment.