Skip to content

Commit 85eca1d

Browse files
Merge pull request #44 from ProteGO-Safe/release/4.9.0
Release/4.9.0
2 parents 5217857 + f34865d commit 85eca1d

595 files changed

Lines changed: 15975 additions & 23471 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"cypress/no-unnecessary-waiting": "error",
4545
"cypress/assertion-before-screenshot": "warn",
4646
"cypress/no-force": "warn",
47-
"cypress/no-async-tests": "error"
47+
"cypress/no-async-tests": "error",
48+
"max-len": ["error", { "code": 120 }]
4849
},
4950
"globals": {
5051
"window": true,

.github/workflows/locale_pr.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
3+
name: Manaul trigger with locales PR
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
SYNC_TERMS:
8+
description: 'Remove unused labels'
9+
required: false
10+
default: 'false'
11+
12+
jobs:
13+
14+
Setup:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
COMMIT_TO: ${{ env.COMMIT_TO }}
18+
TEMP_BRANCH: ${{ env.TEMP_BRANCH }}
19+
ENVIRONMENT: ${{ env.ENVIRONMENT }}
20+
CURRENT_DATE: ${{ env.CURRENT_DATE }}
21+
SYNC_TERMS: ${{ env.SYNC_TERMS }}
22+
steps:
23+
- name: Checkout Repo
24+
uses: actions/checkout@v2
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Check if its DEV repo
29+
if: github.repository_owner != 'ProteGO-Safe'
30+
run: |
31+
echo "ENVIRONMENT=DEV" >> $GITHUB_ENV
32+
33+
- name: Set ENV's
34+
run: |
35+
echo "TEMP_BRANCH=translations/POE-$(date +'%Y-%m-%d%H%M')" >> $GITHUB_ENV
36+
echo "COMMIT_TO=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
37+
echo "CURRENT_DATE=$(date +'%Y-%m-%d_%H:%M')" >> $GITHUB_ENV
38+
echo "SYNC_TERMS=${{ github.event.inputs.SYNC_TERMS }}" >> $GITHUB_ENV
39+
shell: bash
40+
41+
POE_CHECK_UPDATE:
42+
runs-on: ubuntu-latest
43+
needs: [Setup]
44+
if: needs.Setup.outputs.ENVIRONMENT == 'DEV'
45+
outputs:
46+
UPGRADE: ${{ env.UPGRADE }}
47+
env:
48+
COMMIT_TO: ${{ needs.Setup.outputs.COMMIT_TO }}
49+
TEMP_BRANCH: ${{ needs.Setup.outputs.TEMP_BRANCH }}
50+
SYNC_TERMS: ${{ needs.Setup.outputs.SYNC_TERMS }}
51+
steps:
52+
- name: Checkout Repo
53+
uses: actions/checkout@v2
54+
with:
55+
ref: ${{ env.COMMIT_TO }}
56+
57+
- name: Sync terms from PL file
58+
run: |
59+
sh locales/scripts/sync_terms.sh -i ${{ secrets.POEDITOR_ID }} -t ${{ secrets.POEDITOR_TOKEN }} -o locales
60+
if: env.SYNC_TERMS == 'true'
61+
62+
- name: Download REMOTE LOCALES from POEditor
63+
run: |
64+
for l in $(find locales -type f -maxdepth 1 -name "*.json" -exec basename {} .json ';')
65+
do
66+
echo "Processing $l"
67+
mv locales/$l.json /tmp/
68+
sh locales/scripts/export.sh -i ${{ secrets.POEDITOR_ID }} -t ${{ secrets.POEDITOR_TOKEN }} -l $l
69+
if ! diff -q locales/$l.json /tmp/$l.json 2>/dev/null
70+
then
71+
echo "UPGRADE=true" >> $GITHUB_ENV
72+
fi
73+
done
74+
shell: bash
75+
76+
- uses: fregante/setup-git-user@v1
77+
if: env.UPGRADE == 'true'
78+
79+
- name: Git setup new branch
80+
run: |
81+
git checkout -b ${{ env.TEMP_BRANCH }}
82+
git push -u origin ${{ env.TEMP_BRANCH }} -f
83+
if: env.UPGRADE == 'true'
84+
85+
- uses: actions/upload-artifact@master
86+
with:
87+
name: locales
88+
path: locales/*.json
89+
if: env.UPGRADE == 'true'
90+
91+
POE_MAKE_PR:
92+
runs-on: ubuntu-latest
93+
needs: [Setup,POE_CHECK_UPDATE]
94+
if: needs.Setup.outputs.ENVIRONMENT == 'DEV' && needs.POE_CHECK_UPDATE.outputs.UPGRADE == 'true'
95+
env:
96+
COMMIT_TO: ${{ needs.Setup.outputs.COMMIT_TO }}
97+
TEMP_BRANCH: ${{ needs.Setup.outputs.TEMP_BRANCH }}
98+
CURRENT_DATE: ${{ needs.Setup.outputs.CURRENT_DATE }}
99+
steps:
100+
- name: Checkout Repo
101+
uses: actions/checkout@v2
102+
with:
103+
ref: ${{ env.TEMP_BRANCH }}
104+
105+
- name: Download Artifact
106+
uses: actions/download-artifact@master
107+
with:
108+
name: locales
109+
path: locales/
110+
111+
- name: Create Pull Request
112+
id: cpr
113+
uses: peter-evans/create-pull-request@v3
114+
with:
115+
commit-message: Update Locales
116+
base: ${{ env.COMMIT_TO }}
117+
branch: ${{ env.TEMP_BRANCH }}
118+
delete-branch: true
119+
draft: true
120+
title: '[LOCALES] Update to ${{ env.CURRENT_DATE }}'
121+
body: |
122+
Update locales
123+
labels: |
124+
locales
125+
automated pr
126+
127+
- name: Check outputs
128+
run: |
129+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
130+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

.github/workflows/nodejs.yml

Lines changed: 59 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22

3-
name: test, build and deploy
3+
name: Test & Build
44
on:
55
release:
66
types:
@@ -12,40 +12,27 @@ on:
1212
- '**'
1313

1414
jobs:
15-
test:
15+
16+
Setup:
1617
runs-on: ubuntu-latest
17-
strategy:
18-
matrix:
19-
node-version: [13.x]
18+
outputs:
19+
ENVIRONMENT: ${{ env.ENVIRONMENT }}
2020
steps:
21-
- name: Checkout Repo
22-
uses: actions/checkout@v2
23-
- run: yarn install
24-
- run: yarn test
25-
build:
26-
runs-on: ubuntu-latest
27-
strategy:
28-
matrix:
29-
node-version: [13.x]
30-
steps:
31-
- name: Checkout Repo
32-
uses: actions/checkout@v2
33-
3421
- name: Set env to DEV
3522
if: github.repository_owner != 'ProteGO-Safe'
3623
&& startsWith(github.ref, 'refs/heads/release/')
3724
&& github.event_name == 'push'
3825
run: |
3926
echo "ENVIRONMENT=DEV" >> $GITHUB_ENV
40-
27+
4128
- name: Set env to STAGE
4229
if: startsWith(github.ref, 'refs/tags/')
4330
&& github.repository_owner != 'ProteGO-Safe'
4431
&& ( github.event.release.target_commitish == 'master' || startsWith( github.event.release.target_commitish, 'release' ))
4532
&& github.event_name == 'release'
4633
run: |
4734
echo "ENVIRONMENT=STAGE" >> $GITHUB_ENV
48-
35+
4936
- name: Set env to PROD
5037
if: startsWith(github.ref, 'refs/tags/')
5138
&& github.repository_owner == 'ProteGO-Safe'
@@ -54,12 +41,58 @@ jobs:
5441
run: |
5542
echo "ENVIRONMENT=PROD" >> $GITHUB_ENV
5643
44+
Test:
45+
runs-on: ubuntu-latest
46+
strategy:
47+
matrix:
48+
node-version: [13.x]
49+
steps:
50+
- name: Checkout Repo
51+
uses: actions/checkout@v2
52+
- name: Get yarn cache directory path
53+
id: yarn-cache-dir-path
54+
run: echo "::set-output name=dir::$(yarn cache dir)"
55+
- uses: actions/cache@v2
56+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
57+
with:
58+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
59+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
60+
restore-keys: |
61+
${{ runner.os }}-yarn-
62+
- run: yarn install
63+
- run: yarn test
64+
65+
Build:
66+
runs-on: ubuntu-latest
67+
needs: [Setup]
68+
strategy:
69+
matrix:
70+
node-version: [13.x]
71+
env:
72+
ENVIRONMENT: ${{ needs.Setup.outputs.ENVIRONMENT }}
73+
74+
steps:
75+
- name: Checkout Repo
76+
uses: actions/checkout@v2
77+
78+
- name: Get yarn cache directory path
79+
id: yarn-cache-dir-path
80+
run: echo "::set-output name=dir::$(yarn cache dir)"
81+
82+
- uses: actions/cache@v2
83+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
84+
with:
85+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
86+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
87+
restore-keys: |
88+
${{ runner.os }}-yarn-
89+
5790
- name: Set Env's
5891
run: echo "PROJECT_ENVS=${{ secrets[env.EV] }}" >> $GITHUB_ENV
5992
env:
6093
EV: "${{ env.ENVIRONMENT }}_ENV"
61-
if: env.ENVIRONMENT == 'STAGE' || env.ENVIRONMENT == 'PROD' || env.ENVIRONMENT == 'DEV'
62-
94+
if: ${{ needs.Setup.outputs.ENVIRONMENT }}
95+
6396
- name: Upload PL locale to the POEditor
6497
run: |
6598
sh locales/scripts/upload.sh -l pl -i $POEDITOR_ID -t $POEDITOR_TOKEN | grep '"code":"200"' || exit 1
@@ -72,17 +105,17 @@ jobs:
72105
run: echo "CURL_COMMAND=${{ secrets[env.CURL] }}" >> $GITHUB_ENV
73106
env:
74107
CURL: "${{ env.ENVIRONMENT }}_CURL"
75-
if: env.ENVIRONMENT == 'STAGE' || env.ENVIRONMENT == 'PROD' || env.ENVIRONMENT == 'DEV'
108+
if: ${{ needs.Setup.outputs.ENVIRONMENT }}
76109

77110
- name: Inject ENV's for builds
78111
run: 'echo "$PROJECT_ENVS" |base64 --decode > .env'
79112
shell: bash
80-
if: env.ENVIRONMENT == 'STAGE' || env.ENVIRONMENT == 'PROD' || env.ENVIRONMENT == 'DEV'
113+
if: ${{ needs.Setup.outputs.ENVIRONMENT }}
81114

82115
- name: Exec correct curl
83116
run: 'base64 -d <<< $CURL_COMMAND | sh || true'
84117
shell: bash
85-
if: env.ENVIRONMENT == 'STAGE' || env.ENVIRONMENT == 'PROD' || env.ENVIRONMENT == 'DEV'
118+
if: ${{ needs.Setup.outputs.ENVIRONMENT }}
86119

87120
- name: Show GITHUB_CONTEXT
88121
run: |
@@ -96,85 +129,8 @@ jobs:
96129
- run: yarn build
97130

98131
- name: Archive Artifact
99-
if: ( env.ENVIRONMENT == 'STAGE' || env.ENVIRONMENT == 'PROD' || env.ENVIRONMENT == 'DEV' )
132+
if: ${{ needs.Setup.outputs.ENVIRONMENT }}
100133
uses: actions/upload-artifact@master
101134
with:
102135
name: build
103136
path: build
104-
deploy:
105-
needs: build
106-
runs-on: ubuntu-latest
107-
if: ( startsWith(github.ref, 'refs/tags') && github.event_name == 'release' ) || ( startsWith(github.ref, 'refs/heads/release/') && github.event_name == 'push' && github.repository_owner != 'ProteGO-Safe' )
108-
steps:
109-
- name: Checkout Repo
110-
uses: actions/checkout@v2
111-
112-
- name: Set env to DEV
113-
if: github.repository_owner != 'ProteGO-Safe'
114-
&& startsWith(github.ref, 'refs/heads/release/')
115-
&& github.event_name == 'push'
116-
run: |
117-
echo "name=ENVIRONMENT=DEV" >> $GITHUB_ENV
118-
119-
- name: Set env to STAGE
120-
if: startsWith(github.ref, 'refs/tags/')
121-
&& github.repository_owner != 'ProteGO-Safe'
122-
&& startsWith( github.event.release.target_commitish, 'release' )
123-
&& github.event_name == 'release'
124-
run: |
125-
echo "ENVIRONMENT=STAGE" >> $GITHUB_ENV
126-
127-
- name: Set env to PROD
128-
if: startsWith(github.ref, 'refs/tags/')
129-
&& github.repository_owner == 'ProteGO-Safe'
130-
&& ( github.event.release.target_commitish == 'master' || startsWith( github.event.release.target_commitish, 'release/3' ))
131-
&& github.event_name == 'release'
132-
run: |
133-
echo "ENVIRONMENT=PROD" >> $GITHUB_ENV
134-
135-
- name: Download Artifact
136-
uses: actions/download-artifact@master
137-
with:
138-
name: build
139-
path: build
140-
141-
- name: Set Env's from Git refs.
142-
run: |
143-
echo "SOURCE_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
144-
echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
145-
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
146-
echo "GCP_SA_KEY=${{ secrets[env.SECRET_ENV] }}" >> $GITHUB_ENV
147-
echo "SECRET_PROJECT=${{ secrets[env.PROJECT_ENV] }}" >> $GITHUB_ENV
148-
echo "SITE_PROJECT=${{ secrets[env.SITE_ENV] }}" >> $GITHUB_ENV
149-
env:
150-
SECRET_ENV: "${{ env.ENVIRONMENT }}_FIREBASE_HOSTING_SAFE"
151-
PROJECT_ENV: "${{ env.ENVIRONMENT }}_FIREBASE_PROJECT"
152-
SITE_ENV: "${{ env.ENVIRONMENT }}_FIREBASE_SITE"
153-
if: env.ENVIRONMENT == 'STAGE' || env.ENVIRONMENT == 'PROD' || env.ENVIRONMENT == 'DEV'
154-
155-
- name: Set SITE_PROJECT for V4 PROD
156-
run: |
157-
echo "SITE_PROJECT=${{ secrets[env.SITE_ENV] }}-v4" >> $GITHUB_ENV
158-
env:
159-
SITE_ENV: "${{ env.ENVIRONMENT }}_FIREBASE_SITE"
160-
if: ( env.ENVIRONMENT == 'PROD' && github.event.release.target_commitish == 'master' )
161-
162-
- name: Set SITE_PROJECT for V3 in PROD
163-
run: |
164-
echo "SITE_PROJECT=${{ secrets[env.SITE_ENV] }}" >> $GITHUB_ENV
165-
env:
166-
SITE_ENV: "${{ env.ENVIRONMENT }}_FIREBASE_SITE"
167-
if: ( env.ENVIRONMENT == 'PROD' && startsWith( github.event.release.target_commitish, 'release/3' ) )
168-
169-
- run: cp firebase.json build/
170-
if: ( env.ENVIRONMENT == 'STAGE' || env.ENVIRONMENT == 'PROD' || env.ENVIRONMENT == 'DEV' )
171-
172-
- name: Sed Firebase.json
173-
run: sed -ie 's|site_to_sed|${{ env.SITE_PROJECT }}|g' firebase.json
174-
if: ( env.ENVIRONMENT == 'STAGE' || env.ENVIRONMENT == 'PROD' || env.ENVIRONMENT == 'DEV' )
175-
176-
- name: Deploy to Firebase
177-
if: ( env.ENVIRONMENT == 'STAGE' || env.ENVIRONMENT == 'PROD' || env.ENVIRONMENT == 'DEV' )
178-
uses: w9jds/firebase-action@master
179-
with:
180-
args: deploy --only hosting --project $SECRET_PROJECT

0 commit comments

Comments
 (0)