Skip to content

20 snapshot deployment #100

20 snapshot deployment

20 snapshot deployment #100

name: 20 snapshot deployment
on:
push:
branches: [ "next" ]
workflow_dispatch:
jobs:
snapshot:
environment: dev
env:
REPOSILITE_ID: '${{ vars.REPOSILITE_ID }}'
REPOSILITE_URL: '${{ vars.REPOSILITE_URL }}'
REPOSILITE_USER_RELEASE: '${{ secrets.REPOSILITE_USER_RELEASE }}'
REPOSILITE_TOKEN_RELEASE: '${{ secrets.REPOSILITE_TOKEN_RELEASE }}'
REPOSILITE_USER_SNAPSHOT: '${{ secrets.REPOSILITE_USER_SNAPSHOT }}'
REPOSILITE_TOKEN_SNAPSHOT: '${{ secrets.REPOSILITE_TOKEN_SNAPSHOT }}'
APP_FEATURE_PRODUCT: 'example.rcp.app.ui.feature.product'
APP_BUNDLE_PRODUCT: 'example.rcp.app.ui.plugin.product'
APP_FEATURE: 'example-rcp-app-ui-feature'
APP_BUNDLE: 'example-rcp-app-ui-plugin'
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
# - name: caching idefix / ~/.klibio
# uses: actions/cache@v3
# with:
# path: |
# ~/.ecdev
# ~/.m2
# ~/.p2
# key: dev-${{ hashFiles('~/.klibio/klibio.sh') }}
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: |
8
11
17
21
- name: build
shell: bash
env:
REPOSILITE_ID: '${{ vars.REPOSILITE_ID }}'
REPOSILITE_URL: '${{ vars.REPOSILITE_URL }}'
REPOSILITE_USER_RELEASE: '${{ secrets.REPOSILITE_USER_RELEASE }}'
REPOSILITE_TOKEN_RELEASE: '${{ secrets.REPOSILITE_TOKEN_RELEASE }}'
REPOSILITE_USER_SNAPSHOT: '${{ secrets.REPOSILITE_USER_SNAPSHOT }}'
REPOSILITE_TOKEN_SNAPSHOT: '${{ secrets.REPOSILITE_TOKEN_SNAPSHOT }}'
run: |
export JAVA_HOME_8=$JAVA_HOME_8_X64
export JAVA_HOME_11=$JAVA_HOME_11_X64
export JAVA_HOME_17=$JAVA_HOME_17_X64
export JAVA_HOME_21=$JAVA_HOME_21_X64
export PATH=$JAVA_HOME/bin:$PATH
./build.sh --jar-signing --deploy
continue-on-error: true
- name: create release
env:
GH_TOKEN: ${{ github.token }}
run: |
pom_version=$(grep -oPm1 "(?<=<version>)[^<]+" "pom.xml")
if [[ $pom_version =~ ([0-9]+)\.([0-9]+)\.([0-9]+)(.*) ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
bugfix="${BASH_REMATCH[3]}"
snapshot="${BASH_REMATCH[4]}"
else
echo "Version format not recognized."
exit 1
fi
version=$major.$minor.$bugfix
release=rel_$version
snapshot=snapshot_$version
PRODUCTS=$(find releng/products/target -name 'example.rcp.app.ui.*' -type f)
REPO_PRODUCT=$(find releng/products/target -name 'products-*.zip' -type f)
REPO_BINARY=$(find releng/repo.binary/target -name 'repo.binary-*.zip' -type f)
REPO_SDK=$(find releng/repo.sdk/target -name 'repo.sdk-*.zip' -type f)
if [[ $pom_version =~ (.*+SNAPSHOT.*+) ]]; then
echo "eval if snapshot release $snapshot is already existing"
gh release list --json tagName | jq --arg jqSnapshot "$snapshot" 'select(.[].tagName == $jqSnapshot)' > snapshot.json
if [[ -s snapshot.json ]]; then
echo "delete existiong snapshot release, before creating new one"
gh release delete $snapshot
git push --delete origin $snapshot
fi
gh release create $snapshot $PRODUCTS $REPO_BINARY $REPO_PRODUCT $REPO_SDK -p
else
gh release create $release $PRODUCTS $REPO_BINARY $REPO_PRODUCT $REPO_SDK --latest
fi