Skip to content

fixing android issue #325 storage #276

fixing android issue #325 storage

fixing android issue #325 storage #276

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Make branch snapshot and deploy
on:
push:
branches-ignore:
- main
- 'release/**'
jobs:
publish:
if: github.repository == 'eclipse-store/store'
runs-on: ubuntu-latest
steps:
- id: install-secret-key
name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.ORG_GPG_PRIVATE_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- uses: actions/checkout@v3
- name: Set up Java for publishing to Maven Central Snapshot Repository
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-passphrase: PASSPHRASE
- name: Prepare suffix
run: |
function prepareSuffix() {
local branch=$1
local result=${branch//\//_}
result=${result//#/}
local maxLength=10
if (( ${#result} > maxLength )); then
result=${result:0:maxLength}
fi
local hashFromContent=$(echo -n "$branch" | md5sum | cut -f1 -d" ")
echo "${result}-${hashFromContent:0:10}"
}
suffix=$(prepareSuffix ${GITHUB_REF#refs/heads/})
echo "Suffix: $suffix"
echo "SUFFIX=$suffix" >> $GITHUB_ENV
- name: Update project version
run: |
currentVersion=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
currentVersionWithoutSnapshot=${currentVersion%-SNAPSHOT}
newVersion="${currentVersionWithoutSnapshot}-$SUFFIX-SNAPSHOT"
mvn versions:set -DnewVersion=$newVersion --batch-mode
BRANCH_NAME=${{ github.ref }}
REPO_OWNER="eclipse-serializer"
REPO_NAME="serializer"
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/branches/$BRANCH_NAME)
if [ $RESPONSE -eq 200 ]; then
mvn versions:set-property -Dproperty=eclipse.serializer.version -DnewVersion=$newVersion
else
echo "Branch does not exist in serializer repository, skipping serializer version change"
fi
- name: Make a snapshot
run: mvn -Pdeploy -Pproduction --no-transfer-progress --batch-mode clean deploy -U
env:
MAVEN_USERNAME: ${{ secrets.ORG_OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }}
PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }}
#java 17 build
- uses: actions/checkout@v3
- name: Set up Java for publishing to Maven Central Snapshot Repository
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-passphrase: PASSPHRASE
- name: Prepare suffix
run: |
function prepareSuffix() {
local branch=$1
local result=${branch//\//_}
result=${result//#/}
local maxLength=10
if (( ${#result} > maxLength )); then
result=${result:0:maxLength}
fi
local hashFromContent=$(echo -n "$branch" | md5sum | cut -f1 -d" ")
echo "${result}-${hashFromContent:0:10}"
}
suffix=$(prepareSuffix ${GITHUB_REF#refs/heads/})
echo "Suffix: $suffix"
echo "SUFFIX=$suffix" >> $GITHUB_ENV
- name: Update project version java 17
run: |
currentVersion=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
currentVersionWithoutSnapshot=${currentVersion%-SNAPSHOT}
newVersion="${currentVersionWithoutSnapshot}-$SUFFIX-SNAPSHOT"
mvn versions:set -DnewVersion=$newVersion --batch-mode
BRANCH_NAME=${{ github.ref }}
REPO_OWNER="eclipse-serializer"
REPO_NAME="serializer"
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/branches/$BRANCH_NAME)
if [ $RESPONSE -eq 200 ]; then
mvn versions:set-property -Dproperty=eclipse.serializer.version -DnewVersion=$newVersion
else
echo "Branch does not exist in serializer repository, skipping serializer version change"
fi
- name: Make a snapshot java 17
run: |
mvn -pl integrations/spring-boot3 clean install -am -B
mvn -pl integrations/spring-boot3-console clean install -am -B
mvn -P production -pl storage/rest/client-app clean install -am -B
mvn -P production -pl storage/rest/client-app-standalone-assembly clean install -am -B
mvn -P production -pl storage/rest/service-springboot clean install -am -B
- name: Deploy module build with java 17
run: |
mvn -Pdeploy -pl integrations/spring-boot3 deploy
mvn -Pdeploy -pl integrations/spring-boot3-console deploy
mvn -Pdeploy -Pproduction -pl storage/rest/client-app deploy
mvn -Pdeploy -Pproduction -pl storage/rest/client-app-standalone-assembly deploy
mvn -Pdeploy -Pproduction -pl storage/rest/service-springboot deploy
env:
MAVEN_USERNAME: ${{ secrets.ORG_OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }}
PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }}