Skip to content
Draft
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
8 changes: 0 additions & 8 deletions .github/workflows/frontend_build_test_libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ permissions:

on:
workflow_call:
inputs:
project_version:
description: "The determined project version. Required for release-candidate and releases, not for snapshot"
required: false
type: string
default: ""
outputs:
build_artifact_name:
description: Build artifact this workflow produces that can be retrieved with the 'download-artifact' action
Expand Down Expand Up @@ -146,8 +140,6 @@ jobs:
PROJECT_VERSION: ${{ needs.determine_project_version.outputs.project_version }}
run: |
npm run libs-increment-all -- ${PROJECT_VERSION}
npm run copy-frontend-version
npx ng build @valtimo/shared

- name: Cache built frontend libraries
uses: actions/cache/save@v4
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/frontend_publish_release_candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ jobs:
build_and_test:
needs: ["determine_version"]
uses: ./.github/workflows/frontend_build_test_libraries.yml
with:
project_version: ${{ needs.determine_version.outputs.project_version }}
secrets: inherit

publish:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/frontend_publish_to_npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
project_version:
description: "The determined project version. Required for release-candidate, not for snapshot"
required: false
default: ""
type: string
frontend_libraries_build_artifact_name:
required: true
Expand All @@ -31,6 +32,30 @@ jobs:
name: ${{ inputs.frontend_libraries_build_artifact_name }}
path: frontend/dist

- name: Determine project version
id: determine_project_version
if: inputs.project_version == ''
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BUILD_NUMBER: ${{ github.run_number }}
run: |
# replace special characters with - and make all-lowercase
SAFE_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[\/+|<>,;]/-/g' | tr '[:upper:]' '[:lower:]')

SEMVER_VERSION=$(cat gradle.properties | grep 'projectVersion=' | cut -d '=' -f 2)
PROJECT_VERSION="${SEMVER_VERSION}-${SAFE_BRANCH_NAME}.${BUILD_NUMBER}"

echo "Version is ${PROJECT_VERSION}"
echo "project_version=${PROJECT_VERSION}" >> $GITHUB_OUTPUT

- name: Set project version on all libraries
env:
PROJECT_VERSION: ${{ inputs.project_version || steps.determine_project_version.outputs.project_version }}
run: |
npm run libs-increment-all -- ${PROJECT_VERSION} './projects/valtimo'
frontend_libs_version_asset='frontend/dist/valtimo/shared/assets/version.json'
jq ".appVersion = \"${PROJECT_VERSION}\"" "$frontend_libs_version_asset"

- name: "Publish all libs to NPM"
env:
NPM_JS_REPOSITORY_AUTH_TOKEN: ${{ secrets.NPM_JS_REPOSITORY_AUTH_TOKEN }}
Expand Down
4 changes: 1 addition & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"libs:build-6:object-management": "ng build @valtimo/object-management",
"libs:build-7:zgw": "ng build @valtimo/zgw",
"libs:build-7:iko": "ng build @valtimo/iko",
"libs:build-7:copy-version": "npm run copy-frontend-version",
"libs:build:case-migration": "ng build @valtimo/case-migration",
"libs:build:keycloak": "ng build @valtimo/keycloak",
"libs:build:form-view-model": "ng build @valtimo/form-view-model",
Expand Down Expand Up @@ -190,7 +189,6 @@
"libs:lint:access-control-management": "ng lint @valtimo/access-control-management",
"libs:lint:logging": "ng lint @valtimo/logging",
"libs:lint:iko": "ng lint @valtimo/iko",
"copy-frontend-version": "node scripts/copy-frontend-version.js",
"libs-increment-all": "node scripts/libs.increment.all.js",
"libs-publish-all": "node scripts/libs.publish.all.js"
},
Expand Down Expand Up @@ -361,4 +359,4 @@
"@nx/nx-darwin-arm64": "20.8.1",
"@nx/nx-linux-x64-gnu": "20.8.1"
}
}
}
3 changes: 3 additions & 0 deletions frontend/projects/valtimo/shared/assets/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"appVersion": "13.5.0"
}
19 changes: 17 additions & 2 deletions frontend/projects/valtimo/shared/src/lib/constants/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,23 @@

import {Versions} from '../models';

async function getLibVersion() {
let version = 'unknown';
try {
const VERSION_ASSET_URL = '/valtimo-translation/version.json';
const versionRes = await fetch(VERSION_ASSET_URL);
const versionJson = await versionRes.json();
version = versionJson.appVersion;
} catch (err) {
console.error(err);
}
return version;
}

const VERSIONS: Versions = {
frontendLibraries: '13.0.1',
};
frontendLibraries: 'unknown',
} as Versions;

getLibVersion().then(version => (VERSIONS.frontendLibraries = version));

export {VERSIONS};
Loading