mirror of
https://github.com/mudita/mudita-center.git
synced 2025-12-23 22:28:03 -05:00
242 lines
14 KiB
YAML
242 lines
14 KiB
YAML
name: Build & deploy to production
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "*"
|
|
|
|
jobs:
|
|
build:
|
|
if: github.event.base_ref == 'refs/heads/main'
|
|
runs-on: ${{ matrix.runner_label }}
|
|
strategy:
|
|
matrix:
|
|
runner_label: [linux-nexus, windows-nexus, macos-nexus]
|
|
environment: production
|
|
timeout-minutes: 40
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Setup node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18.16.1
|
|
- name: Setup Env for Windows
|
|
if: matrix.runner_label == 'windows-nexus'
|
|
env:
|
|
E2ECI: "false"
|
|
PHRASE_API_KEY: ${{ secrets.PHRASE_API_KEY }}
|
|
PHRASE_API_URL: ${{ secrets.PHRASE_API_URL }}
|
|
PHRASE_API_KEY_DEV: ${{ secrets.PHRASE_API_KEY_DEV }}
|
|
MUDITA_CENTER_SERVER_URL: ${{ secrets.MUDITA_CENTER_SERVER_URL }}
|
|
ROLLBAR_TOKEN: ${{ secrets.ROLLBAR_TOKEN }}
|
|
RELEASES_REPOSITORY_NAME: ${{ secrets.RELEASES_REPOSITORY_NAME }}
|
|
PRERELEASES_ENABLED: ${{ secrets.PRERELEASES_ENABLED }}
|
|
GH_BUILD_TOKEN: ${{ secrets.GH_BUILD_TOKEN }}
|
|
LOGIN_MICROSOFT_ONLINE_CLIENT_ID: ${{ secrets.LOGIN_MICROSOFT_ONLINE_CLIENT_ID }}
|
|
FONTS_DIRECTORY_URL: ${{ secrets.FONTS_DIRECTORY_URL }}
|
|
FRESHDESK_API_URL: ${{ secrets.FRESHDESK_API_URL }}
|
|
FRESHDESK_API_TOKEN: ${{ secrets.FRESHDESK_API_TOKEN }}
|
|
ANALYTICS_ENABLED: ${{ secrets.ANALYTICS_ENABLED }}
|
|
ANALYTICS_API_URL: ${{ secrets.ANALYTICS_API_URL }}
|
|
ANALYTICS_API_SITE_ID: ${{ secrets.ANALYTICS_API_SITE_ID }}
|
|
FEATURE_TOGGLE_ENVIRONMENT: ${{ secrets.FEATURE_TOGGLE_ENVIRONMENT }}
|
|
STATIC_CONFIGURATION_FILE_PATH: ${{ secrets.STATIC_CONFIGURATION_FILE_PATH }}
|
|
DEV_REDUX_LOGGER_ENABLED: ${{ secrets.DEV_REDUX_LOGGER_ENABLED }}
|
|
DEV_DEVICE_LOGGER_ENABLED: ${{ secrets.DEV_DEVICE_LOGGER_ENABLED }}
|
|
FEATURE_TOGGLE_RELEASE_ENVIRONMENT: ${{ secrets.FEATURE_TOGGLE_RELEASE_ENVIRONMENT }}
|
|
LOCALAPPDATA: ""
|
|
shell: cmd
|
|
run: |
|
|
SET > .env
|
|
jq -r -j .version apps/mudita-center/package.json > apps/mudita-center/version
|
|
- name: Setup Env for Windows
|
|
if: matrix.runner_label != 'windows-nexus'
|
|
env:
|
|
PHRASE_API_KEY: ${{ secrets.PHRASE_API_KEY }}
|
|
PHRASE_API_URL: ${{ secrets.PHRASE_API_URL }}
|
|
PHRASE_API_KEY_DEV: ${{ secrets.PHRASE_API_KEY_DEV }}
|
|
MUDITA_CENTER_SERVER_URL: ${{ secrets.MUDITA_CENTER_SERVER_URL }}
|
|
ROLLBAR_TOKEN: ${{ secrets.ROLLBAR_TOKEN }}
|
|
RELEASES_REPOSITORY_NAME: ${{ secrets.RELEASES_REPOSITORY_NAME }}
|
|
PRERELEASES_ENABLED: ${{ secrets.PRERELEASES_ENABLED }}
|
|
GH_BUILD_TOKEN: ${{ secrets.GH_BUILD_TOKEN }}
|
|
LOGIN_MICROSOFT_ONLINE_CLIENT_ID: ${{ secrets.LOGIN_MICROSOFT_ONLINE_CLIENT_ID }}
|
|
FONTS_DIRECTORY_URL: ${{ secrets.FONTS_DIRECTORY_URL }}
|
|
FRESHDESK_API_URL: ${{ secrets.FRESHDESK_API_URL }}
|
|
FRESHDESK_API_TOKEN: ${{ secrets.FRESHDESK_API_TOKEN }}
|
|
ANALYTICS_ENABLED: ${{ secrets.ANALYTICS_ENABLED }}
|
|
ANALYTICS_API_URL: ${{ secrets.ANALYTICS_API_URL }}
|
|
ANALYTICS_API_SITE_ID: ${{ secrets.ANALYTICS_API_SITE_ID }}
|
|
FEATURE_TOGGLE_ENVIRONMENT: ${{ secrets.FEATURE_TOGGLE_ENVIRONMENT }}
|
|
STATIC_CONFIGURATION_FILE_PATH: ${{ secrets.STATIC_CONFIGURATION_FILE_PATH }}
|
|
DEV_REDUX_LOGGER_ENABLED: ${{ secrets.DEV_REDUX_LOGGER_ENABLED }}
|
|
DEV_DEVICE_LOGGER_ENABLED: ${{ secrets.DEV_DEVICE_LOGGER_ENABLED }}
|
|
FEATURE_TOGGLE_RELEASE_ENVIRONMENT: ${{ secrets.FEATURE_TOGGLE_RELEASE_ENVIRONMENT }}
|
|
run: |
|
|
printenv > .env
|
|
- name: Setup depedencies
|
|
run: npm run setup
|
|
# - name: Copy electron-builder environment file for Windows
|
|
# if: matrix.runner_label == 'windows-nexus'
|
|
# run: |
|
|
# copy C:\actions-runner\envs\electron-builder.env apps/mudita-center/electron-builder.env
|
|
- name: Copy electron-builder environment file for Linux/Mac
|
|
if: matrix.runner_label != 'windows-nexus'
|
|
run: |
|
|
cp ~/actions-runner/envs/electron-builder.env apps/mudita-center/electron-builder.env
|
|
- name: Build App for Windows
|
|
if: matrix.runner_label == 'windows-nexus'
|
|
run: |
|
|
$env:NODE_OPTIONS="--max-old-space-size=4096"
|
|
$env:LOCALAPPDATA=""
|
|
npm run app:dist
|
|
- name: Build App for Linux/Mac
|
|
if: matrix.runner_label != 'windows-nexus'
|
|
run: |
|
|
export NODE_OPTIONS="--max-old-space-size=4096"
|
|
npm run app:dist
|
|
- name: Verify apple sign
|
|
if: matrix.runner_label == 'macos-nexus'
|
|
run: |
|
|
codesign -v -v apps/mudita-center/release/mac/Mudita\ Center.app
|
|
- name: Signing via Digicert
|
|
if: matrix.runner_label == 'windows-nexus'
|
|
env:
|
|
SM_HOST: ${{ secrets.SM_HOST }}
|
|
SM_API_KEY: ${{ secrets.SM_API_KEY }}
|
|
SM_CLIENT_CERT_FILE: "C:\\actions-runner\\certs\\Certificate_pkcs12.p12"
|
|
SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
|
|
SM_CODE_SIGNING_CERT_SHA1_HASH: ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}
|
|
run: |
|
|
SET SM_HOST=%SM_HOST%
|
|
SET SM_API_KEY=%SM_API_KEY%
|
|
SET SM_CLIENT_CERT_FILE=%SM_CLIENT_CERT_FILE%
|
|
SET SM_CLIENT_CERT_PASSWORD=%SM_CLIENT_CERT_PASSWORD%
|
|
SET SM_CODE_SIGNING_CERT_SHA1_HASH=%SM_CODE_SIGNING_CERT_SHA1_HASH%
|
|
SET PATH=%PATH%;"C:\Program Files\DigiCert\DigiCert One Signing Manager Tools"
|
|
SET PATH=%PATH%;"C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64"
|
|
signtool.exe sign /sha1 %SM_CODE_SIGNING_CERT_SHA1_HASH% /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 ./apps/mudita-center/release/Mudita-Center.exe
|
|
shell: cmd
|
|
- name: Calculate new checksum and file size for Mudita-Center.exe
|
|
if: matrix.runner_label == 'windows-nexus'
|
|
run: |
|
|
$filePath = "./apps/mudita-center/release/Mudita-Center.exe"
|
|
$sha512Bytes = [System.Security.Cryptography.SHA512]::Create().ComputeHash([System.IO.File]::ReadAllBytes($filePath))
|
|
$sha512Base64 = [Convert]::ToBase64String($sha512Bytes)
|
|
$fileSize = (Get-Item -Path $filePath).length
|
|
|
|
$latestYmlPath = "./apps/mudita-center/release/latest.yml"
|
|
(Get-Content $latestYmlPath) -replace 'sha512:.*', "sha512: $sha512Base64" |
|
|
Set-Content $latestYmlPath
|
|
(Get-Content $latestYmlPath) -replace 'size:.*', "size: $fileSize" |
|
|
Set-Content $latestYmlPath
|
|
shell: powershell
|
|
- name: Push artifacts to nexus registry from Windows
|
|
if: matrix.runner_label == 'windows-nexus'
|
|
env:
|
|
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
|
|
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
|
|
run: |
|
|
$APP_VERSION = Get-Content -Path "apps/mudita-center/version"
|
|
$ENVIRONMENT_CATALOG_NAME="production"
|
|
echo "GITTAG=$($APP_VERSION)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
$GITTAG = "$($APP_VERSION)"
|
|
$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)
|
|
copy ./apps/mudita-center/release/builder-debug.yml ./apps/mudita-center/release/builder-debug-win.yml
|
|
Invoke-WebRequest -Uri https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$($APP_VERSION)/Mudita-Center.exe -InFile ./apps/mudita-center/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/mudita-center/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/mudita-center/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/mudita-center/release/builder-debug-win.yml -Method Put -Credential $AUTH
|
|
C:\"Program Files"\Git\cmd\git.exe clone https://${{ secrets.GH_BUILD_TOKEN }}@github.com/mudita/mudita-center.git
|
|
cd mudita-center
|
|
C:\"Program Files"\Git\cmd\git.exe tag "$GITTAG"
|
|
C:\"Program Files"\Git\cmd\git.exe push origin "$GITTAG"
|
|
- name: Push artifacts to nexus registry from Linux
|
|
if: matrix.runner_label == 'linux-nexus'
|
|
env:
|
|
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
|
|
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
|
|
run: |
|
|
export ENVIRONMENT_CATALOG_NAME=production
|
|
export APP_VERSION=`cat apps/mudita-center/package.json | jq -r .version`
|
|
echo "GITTAG=$APP_VERSION" >> $GITHUB_ENV
|
|
export GITTAG="$APP_VERSION"
|
|
cp ./apps/mudita-center/release/builder-debug.yml ./apps/mudita-center/release/builder-debug-linux.yml
|
|
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./apps/mudita-center/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/mudita-center/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/mudita-center/release/builder-debug-linux.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$APP_VERSION/builder-debug-linux.yml
|
|
git clone https://${{ secrets.GH_BUILD_TOKEN }}@github.com/mudita/mudita-center.git
|
|
cd mudita-center
|
|
git tag "$GITTAG" 2>&1 || true
|
|
git push origin "$GITTAG"
|
|
- name: Push artifacts to nexus registry from macOS
|
|
if: matrix.runner_label == 'macos-nexus'
|
|
env:
|
|
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
|
|
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
|
|
run: |
|
|
export ENVIRONMENT_CATALOG_NAME=production
|
|
export APP_VERSION=`cat apps/mudita-center/package.json | jq -r .version`
|
|
echo "GITTAG=$APP_VERSION" >> $GITHUB_ENV
|
|
export GITTAG="$APP_VERSION"
|
|
cp ./apps/mudita-center/release/builder-debug.yml ./apps/mudita-center/release/builder-debug-mac.yml
|
|
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./apps/mudita-center/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/mudita-center/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/mudita-center/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/mudita-center/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/mudita-center/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/mudita-center/release/builder-debug-mac.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIRONMENT_CATALOG_NAME/$APP_VERSION/builder-debug-mac.yml
|
|
git clone https://${{ secrets.GH_BUILD_TOKEN }}@github.com/mudita/mudita-center.git
|
|
cd mudita-center
|
|
git tag "$GITTAG" 2>&1 || true
|
|
git push origin "$GITTAG"
|
|
- name: Create draft release with Windows files
|
|
if: matrix.runner_label == 'windows-nexus'
|
|
id: create_release_windows
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: ${{ env.GITTAG }}
|
|
name: Mudita Center v${{ env.GITTAG }}
|
|
repository: mudita/mudita-center
|
|
token: ${{ secrets.GH_BUILD_TOKEN }}
|
|
draft: true
|
|
files: |
|
|
./apps/mudita-center/release/Mudita-Center.exe
|
|
./apps/mudita-center/release/Mudita-Center.exe.blockmap
|
|
./apps/mudita-center/release/latest.yml
|
|
./apps/mudita-center/release/builder-debug-win.yml
|
|
- name: Create draft release with Linux files
|
|
if: matrix.runner_label == 'linux-nexus'
|
|
id: create_release_linux
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: ${{ env.GITTAG }}
|
|
name: Mudita Center v${{ env.GITTAG }}
|
|
repository: mudita/mudita-center
|
|
token: ${{ secrets.GH_BUILD_TOKEN }}
|
|
draft: true
|
|
files: |
|
|
./apps/mudita-center/release/Mudita-Center.AppImage
|
|
./apps/mudita-center/release/latest-linux.yml
|
|
./apps/mudita-center/release/builder-debug-linux.yml
|
|
- name: Create draft release with Mac files
|
|
if: matrix.runner_label == 'macos-nexus'
|
|
id: create_release_macos
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: ${{ env.GITTAG }}
|
|
name: Mudita Center v${{ env.GITTAG }}
|
|
repository: mudita/mudita-center
|
|
token: ${{ secrets.GH_BUILD_TOKEN }}
|
|
draft: true
|
|
files: |
|
|
./apps/mudita-center/release/Mudita-Center.dmg
|
|
./apps/mudita-center/release/Mudita-Center.zip
|
|
./apps/mudita-center/release/Mudita-Center.zip.blockmap
|
|
./apps/mudita-center/release/Mudita-Center.dmg.blockmap
|
|
./apps/mudita-center/release/latest-mac.yml
|
|
./apps/mudita-center/release/builder-debug-mac.yml
|