Skip to content

Commit

Permalink
Update 20_snapshot-deployment.yml (#12)
Browse files Browse the repository at this point in the history
* Update 20_snapshot-deployment.yml
* Update setup-idefix.sh
* improve doc
* fixing release attachment
* initial release
* deploy snapshot/release
  • Loading branch information
peterkir authored May 22, 2024
1 parent 25811b3 commit e816b02
Show file tree
Hide file tree
Showing 22 changed files with 181 additions and 106 deletions.
49 changes: 31 additions & 18 deletions .github/workflows/10_build-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,10 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
build:
environment: dev
env:
REPOSILITE_ID: ${{ vars.REPOSILITE_ID }}
REPOSILITE_URL: ${{ vars.REPOSILITE_URL }}
REPOSILITE_USERNAME: ${{ secrets.REPOSILITE_USERNAME }}
REPOSILITE_TOKEN: ${{ secrets.REPOSILITE_TOKEN }}
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:
Expand All @@ -35,14 +25,37 @@ jobs:
# ~/.p2
# key: dev-${{ hashFiles('~/.klibio/klibio.sh') }}

- name: setup idefix
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: |
8
11
17
21
- name: build
shell: bash
run: |
$GITHUB_WORKSPACE/.github/workflows/setup-idefix.sh
continue-on-error: false

- name: build
echo -e "#\n# build\n#\n"
echo "# configure environment for maven/tycho calls"
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
continue-on-error: true

- name: validate-build-results
shell: bash
run: |
./build.sh
continue-on-error: false
NUM_PRODUCTS=$(find releng/products/target -name 'example.rcp.app.ui.*' -type f | wc -l)
NUM_REPO_PRODUCT=$(find releng/products/target -name 'products-*.zip' -type f | wc -l)
NUM_REPO_BINARY=$(find releng/repo.binary/target -name 'repo.binary-*.zip' -type f | wc -l)
NUM_REPO_SDK=$(find releng/repo.sdk/target -name 'repo.sdk-*.zip' -type f | wc -l)
[[ $NUM_PRODUCTS -gt 0 ]] & echo "products existing!"
[[ $NUM_REPO_PRODUCT -ne 0 ]] & echo "product repo existing!"
[[ $NUM_REPO_BINARY -ne 0 ]] & echo "binary repo existing!"
[[ $NUM_REPO_SDK -ne 0 ]] & echo "sdk repo existing!"
86 changes: 56 additions & 30 deletions .github/workflows/20_snapshot-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@ on:

jobs:
snapshot:
environment: dev
runs-on: ubuntu-latest
env:
REPOSILITE_ID: '${{ vars.REPOSILITE_ID }}'
REPOSILITE_URL: '${{ vars.REPOSILITE_URL }}'
REPOSILITE_USERNAME: '${{ secrets.REPOSILITE_USERNAME }}'
REPOSILITE_TOKEN: '${{ secrets.REPOSILITE_TOKEN }}'
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
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 }}'

steps:

Expand All @@ -34,29 +30,59 @@ jobs:
# ~/.p2
# key: dev-${{ hashFiles('~/.klibio/klibio.sh') }}

- name: setup idefix
shell: bash
run: |
.github/workflows/setup-idefix.sh
continue-on-error: false
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: |
8
11
17
21
- name: build
shell: bash
run: |
echo -e "#\n# build\n#\n"
echo "# configure environment for maven/tycho calls"
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: false

- name: Generate Changelog
run: echo "# Good things have arrived" > ${{ github.workspace }}-CHANGELOG.txt

- name: Release
uses: softprops/action-gh-release@v2
# if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ github.workspace }}-CHANGELOG.txt
releng/repo.binary/target/repository/p2.index
releng/repo.binary/target/repository/content.xml.xz
releng/repo.binary/target/repository/artifacts.xml.xz
draft: true
prerelease: false
continue-on-error: true

- name: create release
shell: bash
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
83 changes: 59 additions & 24 deletions .github/workflows/30_release-deployment.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: 30 release deployment

on:
# push:
# branches: [ "main" ]
workflow_dispatch:
inputs:
release-version:
Expand All @@ -16,18 +14,14 @@ on:

jobs:
release:
environment: release
runs-on: ubuntu-latest
env:
REPOSILITE_ID: '${{ vars.REPOSILITE_ID }}'
REPOSILITE_URL: '${{ vars.REPOSILITE_URL }}'
REPOSILITE_USERNAME: '${{ secrets.REPOSILITE_USERNAME }}'
REPOSILITE_TOKEN: '${{ secrets.REPOSILITE_TOKEN }}'
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
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 }}'

steps:

Expand All @@ -43,18 +37,25 @@ jobs:
# ~/.p2
# key: dev-${{ hashFiles('~/.klibio/klibio.sh') }}

- name: setup idefix
shell: bash
run: |
.github/workflows/setup-idefix.sh
continue-on-error: false
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: |
8
11
17
21
- name: build
shell: bash
run: |
echo -e "#\n# build\n#\n"
echo "# configure environment for maven/tycho calls"
export JAVA_HOME=~/.klibio/java/ee/JAVA17
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
echo -e "#\n# update to release version $RELEASE_VERSION\n#\n"
./mvnw org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=$RELEASE_VERSION
Expand All @@ -65,16 +66,50 @@ jobs:
echo -e "#\n# RELEASE build and deploy to artifactory\n#\n"
MAVEN_OPTS="-Dtycho.localArtifacts=ignore -Dmaven.repo.local=.local_m2_cache"
./build.sh --jar-signing --deploy
continue-on-error: true

echo -e "#\n# tag RELEASE in git\n#\n"
git tag -a rel_$RELEASE_VERSION -m "release $RELEASE_VERSION" && git push --tags
- name: create release
shell: bash
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
echo -e "#\n# start next development release cycle with new version $NEXT_SNAPSHOT_VERSION\n#\n"
- name: start next development cycle
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run:
echo -e "#\n# start next development cycle with new version $NEXT_SNAPSHOT_VERSION\n#\n"
./mvnw org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=$NEXT_SNAPSHOT_VERSION
git add . && git commit -m "starting next dev cycle - new version $NEXT_SNAPSHOT_VERSION" && git push
git tag -a $NEXT_SNAPSHOT_VERSION -m "start dev cycle with version $NEXT_SNAPSHOT_VERSION" && git push --tags
env:
RELEASE_VERSION: ${{ github.event.inputs.release-version }}
NEXT_SNAPSHOT_VERSION: ${{ github.event.inputs.next-snaphot-version }}
continue-on-error: false
12 changes: 9 additions & 3 deletions .github/workflows/setup-idefix.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
002-setup-idefix.sh#!/bin/bash
#!/bin/bash
if [[ ${debug:-false} == true ]]; then
set -o xtrace # activate bash debug
fi
Expand All @@ -10,7 +10,13 @@ if [ -d ~/${bootstrap} ]; then
echo "using existing idefix tooling from ~/${bootstrap} - skipping provisioning"
else
echo "provisioning idefix tooling inside ~/${bootstrap} - please be patient"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/klibio/bootstrap/main/install-klibio.sh)" bash -j
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/klibio/bootstrap/main/install-klibio.sh)" bash -j
export KLIBIO=$(echo ${HOME}/.klibio)
lib_url=https://raw.githubusercontent.com/klibio/bootstrap/main/.klibio/klibio.sh
echo "# sourcing klibio library - ${lib_url}"
install_dir=${HOME}
$(curl -fs${unsafe:-}SLO ${lib_url})
. klibio.sh -j
fi

echo execution completed at $(date +"%Y-%m-%d_%H-%M-%S")
echo execution completed at $(date +"%Y-%m-%d_%H-%M-%S")
8 changes: 4 additions & 4 deletions .mvn/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
</server>
<server>
<id>klibio-maven-releases</id>
<username>${env.REPOSILITE_USERNAME}</username>
<password>${env.REPOSILITE_TOKEN}</password>
<username>${env.REPOSILITE_USER_RELEASE}</username>
<password>${env.REPOSILITE_TOKEN_RELEASE}</password>
</server>
<server>
<id>klibio-maven-snapshots</id>
<username>${env.REPOSILITE_USERNAME}</username>
<password>${env.REPOSILITE_TOKEN}</password>
<username>${env.REPOSILITE_USER_SNAPSHOT}</username>
<password>${env.REPOSILITE_TOKEN_SNAPSHOT}</password>
</server>
</servers>

Expand Down
10 changes: 5 additions & 5 deletions .mvn/toolchains.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<version>21</version>
</provides>
<configuration>
<jdkHome>${env.HOME}/.klibio/java/ee/JAVA21</jdkHome>
<jdkHome>${env.JAVA_HOME_21}</jdkHome>
</configuration>
</toolchain>
<toolchain>
Expand All @@ -20,7 +20,7 @@
<version>17</version>
</provides>
<configuration>
<jdkHome>${env.HOME}/.klibio/java/ee/JAVA17</jdkHome>
<jdkHome>${env.JAVA_HOME_17}</jdkHome>
</configuration>
</toolchain>
<toolchain>
Expand All @@ -31,7 +31,7 @@
<version>11</version>
</provides>
<configuration>
<jdkHome>${env.HOME}/.klibio/java/ee/JAVA11</jdkHome>
<jdkHome>${env.JAVA_HOME_11}</jdkHome>
</configuration>
</toolchain>
<!-- not available on macosx aarch64
Expand All @@ -43,8 +43,8 @@
<version>8</version>
</provides>
<configuration>
<jdkHome>${env.HOME}/.klibio/java/ee/JAVA8</jdkHome>
<jdkHome>${env.JAVA_HOME_8}</jdkHome>
</configuration>
</toolchain>
-->
</toolchains>
</toolchains>
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# example for Eclipse RCP applications

{{ page.date| date: "%m-%d-%Y" }}

## build pipelines

| github action | output |
Expand All @@ -11,8 +9,6 @@
| [![SNAPSHOT build](https://github.com/klibio/example.pde.rcp/actions/workflows/20_snapshot-deployment.yml/badge.svg)](https://github.com/klibio/example.pde.rcp/actions/workflows/20_snapshot-deployment.yml) | [![snapshot](https://reposilite.klib.io/api/badge/latest/snapshots/example/rcp/products/?color=40c14a&name=Maven%20SNAPSHOT%20repo%20example.pde.rcp)](https://reposilite.klib.io/#/snapshots/example/rcp/products) |
| [![RELEASE build](https://github.com/klibio/example.pde.rcp/actions/workflows/30_release-deployment.yml/badge.svg)](https://github.com/klibio/example.pde.rcp/actions/workflows/30_release-deployment.yml) | [![release](https://reposilite.klib.io/api/badge/latest/releases/example/rcp/products/?color=40c14a&name=Maven%20RELEASE%20repo%20example.pde.rcp)](https://reposilite.klib.io/#/releases/example/rcp/products) |



## pre-requisites

based on github repo [klibio/bootstrap](https://github.com/klibio/bootstrap)
Expand Down
Loading

0 comments on commit e816b02

Please sign in to comment.