-
Notifications
You must be signed in to change notification settings - Fork 8
191 lines (189 loc) · 11.9 KB
/
nexus-mock-production.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Build & deploy (mock) to production
on:
push:
tags:
- "*"
jobs:
build:
if: github.event.base_ref == 'refs/heads/main'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [Linux, Windows, macOS]
environment: production
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.os == 'Windows'
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 }}
MUDITA_CENTER_SERVER_V2_URL: ${{ secrets.MUDITA_CENTER_SERVER_V2_URL }}
ROLLBAR_TOKEN: ${{ secrets.ROLLBAR_TOKEN }}
RELEASES_REPOSITORY_NAME: ${{ secrets.RELEASES_REPOSITORY_NAME }}
PRERELEASES_ENABLED: ${{ secrets.PRERELEASES_ENABLED }}
GITHUB_ACCESS_TOKEN: ${{ secrets.MC_GITHUB_ACCESS_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 }}
DEV_TOOLS_SHORTCUT_ENABLED: "1"
LOCALAPPDATA: ""
MOCK_SERVICE_ENABLED: "1"
KOMPAKT_OS_UPDATE_DEV_TOKEN: ${{ secrets.KOMPAKT_OS_UPDATE_DEV_TOKEN }}
shell: cmd
run: |
SET > .env
jq -r -j .version apps/mudita-center/package.json > apps/mudita-center/version
- name: Setup Env for MacOS and Linux
if: matrix.os != 'Windows'
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 }}
MUDITA_CENTER_SERVER_V2_URL: ${{ secrets.MUDITA_CENTER_SERVER_V2_URL }}
ROLLBAR_TOKEN: ${{ secrets.ROLLBAR_TOKEN }}
RELEASES_REPOSITORY_NAME: ${{ secrets.RELEASES_REPOSITORY_NAME }}
PRERELEASES_ENABLED: ${{ secrets.PRERELEASES_ENABLED }}
GITHUB_ACCESS_TOKEN: ${{ secrets.MC_GITHUB_ACCESS_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 }}
DEV_TOOLS_SHORTCUT_ENABLED: "1"
MOCK_SERVICE_ENABLED: "1"
KOMPAKT_OS_UPDATE_DEV_TOKEN: ${{ secrets.KOMPAKT_OS_UPDATE_DEV_TOKEN }}
run: |
printenv > .env
- name: Changing app version in packages.json for Linux
if: matrix.os == 'Linux'
run: |
export APP_VERSION=`cat apps/mudita-center/package.json | jq -r .version`
export BUILD_VERSION=-mock
sed -i "s/\"version\": \".*\",/\"version\": \"$APP_VERSION$BUILD_VERSION\",/" apps/mudita-center/package.json
- name: Changing app version in packages.json for Mac
if: matrix.os == 'macOS'
run: |
export APP_VERSION=`cat apps/mudita-center/package.json | jq -r .version`
export BUILD_VERSION=-mock
sed -i '' "s/\"version\": \".*\",/\"version\": \"$APP_VERSION$BUILD_VERSION\",/" apps/mudita-center/package.json
- name: Changing app version in packages.json for Windows
if: matrix.os == 'Windows'
run: |
$BUILD_VERSION = "-mock"
$APP_VERSION = (Get-Content -Path "apps/mudita-center/version") + $BUILD_VERSION
(Get-Content -Path 'apps/mudita-center/package.json') | ForEach-Object {
$_ -replace '"version": ".*",' , "`"version`"`: `"$APP_VERSION`","
} | Set-Content -Path 'apps/mudita-center/package.json'
- name: Setup depedencies
run: npm run setup
# - name: Copy electron-builder environment file for Windows
# if: matrix.os == 'Windows'
# 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.os != 'Windows'
run: |
cp ~/actions-runner/envs/electron-builder.env apps/mudita-center/electron-builder.env
- name: Build App for Windows
if: matrix.os == 'Windows'
run: |
$env:NODE_OPTIONS="--max-old-space-size=4096"
$env:LOCALAPPDATA=""
npm run app:dist
- name: Build App for Linux/Mac
if: matrix.os != 'Windows'
run: |
export NODE_OPTIONS="--max-old-space-size=4096"
npm run app:dist
- name: Verify apple sign
if: matrix.os == 'macOS'
run: |
codesign -v -v apps/mudita-center/release/mac/Mudita\ Center.app
- name: Push artifacts to nexus registry from Windows
if: matrix.os == 'Windows'
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
$BUILD_VERSION = "-mock"
$APP_VERSION = (Get-Content -Path "apps/mudita-center/version") + $BUILD_VERSION
$ENVIRONMENT_CATALOG_NAME="mock-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.MC_GITHUB_ACCESS_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.os == 'Linux'
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
export ENVIRONMENT_CATALOG_NAME=mock-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.MC_GITHUB_ACCESS_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.os == 'macOS'
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
export ENVIRONMENT_CATALOG_NAME=mock-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.MC_GITHUB_ACCESS_TOKEN }}@github.com/mudita/mudita-center.git
cd mudita-center
git tag "$GITTAG" 2>&1 || true
git push origin "$GITTAG"