Skip to content

[CP-3907][App Refactor][Kompakt] Manage Files - upload - mtp - implem… #4860

[CP-3907][App Refactor][Kompakt] Manage Files - upload - mtp - implem…

[CP-3907][App Refactor][Kompakt] Manage Files - upload - mtp - implem… #4860

name: Build & Release - feature branch
on:
push:
branches:
- CP-*
jobs:
release:
runs-on: ${{ matrix.runner_label }}
strategy:
matrix:
runner_label: [linux-nexus, windows-nexus, macos-nexus]
node-version: [22.16.0]
environment: development-next
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Configure environment - Windows
if: matrix.runner_label == 'windows-nexus'
env:
FONTS_DIRECTORY_URL: ${{ secrets.FONTS_DIRECTORY_URL }}
RELEASES_REPOSITORY_NAME: ${{ secrets.RELEASES_REPOSITORY_NAME }}
GH_BUILD_TOKEN: ${{ secrets.GH_BUILD_TOKEN }}
VITE_GH_RUNTIME_TOKEN: ${{ secrets.VITE_GH_RUNTIME_TOKEN }}
VITE_MUDITA_CENTER_SERVER_URL: ${{ secrets.MUDITA_CENTER_SERVER_URL }}
CI: true
shell: cmd
run: |
SET > .env
jq -r -j .version apps/app/package.json > apps/app/version
- name: Configure environment - Mac
if: matrix.runner_label == 'macos-nexus'
env:
FONTS_DIRECTORY_URL: ${{ secrets.FONTS_DIRECTORY_URL }}
RELEASES_REPOSITORY_NAME: ${{ secrets.RELEASES_REPOSITORY_NAME }}
GH_BUILD_TOKEN: ${{ secrets.GH_BUILD_TOKEN }}
VITE_GH_RUNTIME_TOKEN: ${{ secrets.VITE_GH_RUNTIME_TOKEN }}
VITE_MUDITA_CENTER_SERVER_URL: ${{ secrets.MUDITA_CENTER_SERVER_URL }}
CI: true
run: |
printenv > .env
- name: Configure environment - Linux
if: matrix.runner_label == 'linux-nexus'
env:
FONTS_DIRECTORY_URL: ${{ secrets.FONTS_DIRECTORY_URL }}
RELEASES_REPOSITORY_NAME: ${{ secrets.RELEASES_REPOSITORY_NAME }}
GH_BUILD_TOKEN: ${{ secrets.GH_BUILD_TOKEN }}
VITE_GH_RUNTIME_TOKEN: ${{ secrets.VITE_GH_RUNTIME_TOKEN }}
VITE_MUDITA_CENTER_SERVER_URL: ${{ secrets.MUDITA_CENTER_SERVER_URL }}
CI: true
run: |
printenv > .env
- name: Update app version - Windows
if: matrix.runner_label == 'windows-nexus'
run: |
$SOURCE_BRANCH = "${{ github.ref_name }}"
$ENVIRONMENT_CATALOG_NAME = "feature-branch/${{ github.ref_name }}"
$BUILD_VERSION = "-dev.${{ github.run_number }}"
$APP_VERSION = (Get-Content -Path "apps/app/version") + $BUILD_VERSION
(Get-Content -Path 'apps/app/package.json') | ForEach-Object {
$_ -replace '"version": ".*",' , "`"version`"`: `"$APP_VERSION`","
} | Set-Content -Path 'apps/app/package.json'
- name: Update app version - Mac
if: matrix.runner_label == 'macos-nexus'
run: |
export APP_VERSION=`cat apps/app/package.json | jq -r .version`
export SOURCE_BRANCH=${{ github.ref_name }}
export "ENVIRONMENT_CATALOG_NAME=feature-branch/${{ github.ref_name }}"
export "BUILD_VERSION=-dev.${{ github.run_number }}"
sed -i '' "s/\"version\": \".*\",/\"version\": \"$APP_VERSION$BUILD_VERSION\",/" apps/app/package.json
- name: Update app version - Linux
if: matrix.runner_label == 'linux-nexus'
run: |
export APP_VERSION=`cat apps/app/package.json | jq -r .version`
export SOURCE_BRANCH=${{ github.ref_name }}
export "ENVIRONMENT_CATALOG_NAME=feature-branch/${{ github.ref_name }}"
export "BUILD_VERSION=-dev.${{ github.run_number }}"
sed -i "s/\"version\": \".*\",/\"version\": \"$APP_VERSION$BUILD_VERSION\",/" apps/app/package.json
- name: Install dependencies
run: npm run setup
- name: Build - Windows
if: matrix.runner_label == 'windows-nexus'
run: |
$env:NODE_OPTIONS="--max-old-space-size=4096"
$env:LOCALAPPDATA=""
npx nx build:win app --publish never --output-style stream --no-cloud
- name: Build - Mac
if: matrix.runner_label == 'macos-nexus'
run: |
export CSC_IDENTITY_AUTO_DISCOVERY=false
export NODE_OPTIONS="--max-old-space-size=4096"
npx nx build:mac app --publish never --universal --output-style stream --no-cloud
- name: Build - Linux
if: matrix.runner_label == 'linux-nexus'
run: |
export NODE_OPTIONS="--max-old-space-size=4096"
npx nx build:linux app --publish never --output-style stream --no-cloud
- name: Upload artifacts to Nexus - Windows
if: matrix.runner_label == 'windows-nexus'
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
jq -r -j .version apps/app/package.json > apps/app/version
$APP_VERSION = Get-Content -Path "apps/app/version"
$SOURCE_BRANCH = "${{ github.ref_name }}"
$ENVIRONMENT_CATALOG_NAME = "feature-branch/${{ github.ref_name }}"
$NEXUS_USERNAME = "$env:NEXUS_USERNAME"
$NEXUS_PASSWORD = ConvertTo-SecureString "$env:NEXUS_PASSWORD" -AsPlainText -Force
$AUTH = New-Object System.Management.Automation.PSCredential ($NEXUS_USERNAME, $NEXUS_PASSWORD)
Invoke-WebRequest -Uri https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$($APP_VERSION)/Mudita-Center.exe -InFile ./apps/app/release/Mudita-Center.exe -Method Put -Credential $AUTH
Invoke-WebRequest -Uri https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$($APP_VERSION)/Mudita-Center.exe.blockmap -InFile ./apps/app/release/Mudita-Center.exe.blockmap -Method Put -Credential $AUTH
Invoke-WebRequest -Uri https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$($APP_VERSION)/latest.yml -InFile ./apps/app/release/latest.yml -Method Put -Credential $AUTH
Invoke-WebRequest -Uri https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$($APP_VERSION)/builder-debug-win.yml -InFile ./apps/app/release/builder-debug.yml -Method Put -Credential $AUTH
- name: Upload artifacts to Nexus - Linux
if: matrix.runner_label == 'linux-nexus'
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
export APP_VERSION=`cat apps/app/package.json | jq -r .version`
export SOURCE_BRANCH=${{ github.ref_name }}
export "ENVIRONMENT_CATALOG_NAME=feature-branch/${{ github.ref_name }}"
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./apps/app/release/Mudita-Center.AppImage https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$APP_VERSION/Mudita-Center.AppImage
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./apps/app/release/latest-linux.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$APP_VERSION/latest-linux.yml
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./apps/app/release/builder-debug.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$APP_VERSION/builder-debug-linux.yml
- name: Upload artifacts to Nexus - Mac
if: matrix.runner_label == 'macos-nexus'
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
export APP_VERSION=`cat apps/app/package.json | jq -r .version`
export SOURCE_BRANCH=${{ github.ref_name }}
export "ENVIRONMENT_CATALOG_NAME=feature-branch/${{ github.ref_name }}"
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./apps/app/release/Mudita-Center.dmg https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$APP_VERSION/Mudita-Center.dmg
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./apps/app/release/Mudita-Center.zip https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$APP_VERSION/Mudita-Center.zip
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./apps/app/release/Mudita-Center.zip.blockmap https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$APP_VERSION/Mudita-Center.zip.blockmap
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./apps/app/release/Mudita-Center.dmg.blockmap https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$APP_VERSION/Mudita-Center.dmg.blockmap
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./apps/app/release/latest-mac.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$APP_VERSION/latest-mac.yml
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./apps/app/release/builder-debug.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$APP_VERSION/builder-debug-mac.yml