Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENG-4849 publish the new version menu epc image and update component manager #56

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/functions/utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
function setBundleVersion() {
local versionSuffix=$1
version=$(ent bundle info | grep "Version:" | awk '{print $2}')
ver="$version$versionSuffix"
value=".version=\"$ver\""
jq $value entando.json > temp.json && mv temp.json entando.json
}

function setBundleVersionTag() {
local version=$1
echo "VERSION: $version"
value=".version=\"$version\""
jq $value entando.json > temp.json && mv temp.json entando.json
}

function getBundleImage() {
ent bundle images | grep bundle | awk '{printf "%s:%s", $1, $2}'
}

function setComponentVersions() {
local versionSuffix=$1

components=$(ent bundle list | tail -n +$((n + 3)))
while IFS= read -r line
do
name=$(echo $line | awk '{print $1}')
type=$(echo $line | awk '{print $2}')
version=$(echo $line | awk '{print $3}')
stack=$(echo $line | awk '{print $4}')

# Enter component folder
cd "$type"s/"$name"

ver="$version$versionSuffix"
echo "Setting version=$ver for component $name"

if [ "$stack" = "spring-boot" ]; then
mvn versions:set -DnewVersion="$ver" > /dev/null
fi

if [ "$stack" = "react" ] || [ "$stack" = "node" ]; then
value=".version=\"$ver\""
jq $value package.json > temp.json && mv temp.json package.json
fi

# Return back to bundle folder
cd ../../

done <<< "$components"
}

function setComponentVersionsTag() {
local ver=$1

components=$(ent bundle list | tail -n +$((n + 3)))
while IFS= read -r line
do
name=$(echo $line | awk '{print $1}')
type=$(echo $line | awk '{print $2}')
version=$(echo $line | awk '{print $3}')
stack=$(echo $line | awk '{print $4}')

# Enter component folder
cd "$type"s/"$name"

echo "Setting version=$ver for component $name"

if [ "$stack" = "spring-boot" ]; then
mvn versions:set -DnewVersion="$ver" > /dev/null
fi

if [ "$stack" = "react" ] || [ "$stack" = "node" ]; then
value=".version=\"$ver\""
jq $value package.json > temp.json && mv temp.json package.json
fi

# Return back to bundle folder
cd ../../

done <<< "$components"
}

"$@"
35 changes: 35 additions & 0 deletions .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Post merge workflow
on:
push:
branches:
- develop
- release/*
jobs:
app-build:
runs-on: ubuntu-latest
container:
image: entando/ent:v7.1.3
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: registry.hub.docker.com
username: ${{ secrets.ENTANDO_OPT_DOCKER_USERNAME }}
password: ${{ secrets.ENTANDO_OPT_DOCKER_PASSWORD }}
- name: Pack the application bundle
id: pack
env:
DOCKER_ORG: entando
run: |
versionSuffix=SNAPSHOT
bash ./.github/functions/utils.sh setBundleVersion -$versionSuffix
bash ./.github/functions/utils.sh setComponentVersions -$versionSuffix
ent --debug bundle pack --org $DOCKER_ORG --stdout --fail-fast
ent --debug bundle publish
version=$(bash ./.github/functions/utils.sh getBundleImage)
echo "VERSION=$version" >> $GITHUB_OUTPUT
working-directory: ./
46 changes: 46 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: PR workflow
on:
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
app-build:
runs-on: ubuntu-latest
container:
image: entando/ent:v7.1.3
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Check PR name
uses: Slashgear/[email protected]
with:
regexp: "(^ENG-[0-9]{3,5} .*$|^ENGPM-[0-9]{3,5} .*$)"
helpMessage: "Example: 'ENG-123 A change' or 'ENGPM-123 A change'"
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: registry.hub.docker.com
username: ${{ secrets.ENTANDO_OPT_DOCKER_USERNAME }}
password: ${{ secrets.ENTANDO_OPT_DOCKER_PASSWORD }}
- name: Pack the application bundle
id: pack
env:
DOCKER_ORG: entando
run: |
versionSuffix=$(echo "${{ github.event.pull_request.title }}" | awk '{print $1}')
bash ./.github/functions/utils.sh setBundleVersion -$versionSuffix
bash ./.github/functions/utils.sh setComponentVersions -$versionSuffix
ent --debug bundle pack --org $DOCKER_ORG --stdout --fail-fast
ent --debug bundle publish
version=$(bash ./.github/functions/utils.sh getBundleImage)
echo "VERSION=$version" >> $GITHUB_OUTPUT
working-directory: ./
- name: Publish artifact version
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Requested publication of version: `${{ steps.pack.outputs.VERSION }}`
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release
on:
create:
tags:
- 'v*'
jobs:
app-build:
runs-on: ubuntu-latest
container:
image: entando/ent:v7.1.3
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: registry.hub.docker.com
username: ${{ secrets.ENTANDO_OPT_DOCKER_USERNAME }}
password: ${{ secrets.ENTANDO_OPT_DOCKER_PASSWORD }}
- name: Get release tag
id: release
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Pack the application bundle
id: pack
env:
DOCKER_ORG: entando
RELEASE_VERSION: ${{ steps.release.outputs.tag }}
run: |
bash ./.github/functions/utils.sh setBundleVersionTag ${RELEASE_VERSION#v}
bash ./.github/functions/utils.sh setComponentVersionsTag ${RELEASE_VERSION#v}
ent --debug bundle pack --org $DOCKER_ORG --stdout --fail-fast
ent --debug bundle publish
version=$(bash ./.github/functions/utils.sh getBundleImage)
echo "VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
working-directory: ./
2 changes: 1 addition & 1 deletion entando.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"svc": [],
"name": "entando-ab-core-navigation",
"version": "1.0.2",
"version": "1.0.4",
"description": "EPC Layout Capabilities for App Builder",
"type": "bundle"
}
2 changes: 1 addition & 1 deletion microfrontends/app-builder-menu/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "app-builder-menu",
"private": true,
"version": "1.0.2",
"version": "1.0.4",
"scripts": {
"start": "vite",
"build": "tsc && vite build",
Expand Down