Skip to content

Commit

Permalink
Add crowdin workflow changes to redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
lorcan-codes committed Sep 4, 2023
1 parent 15be58c commit 2b8ec1f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Crowdin Action

on:
schedule:
- cron: "0 1 * * *" # every day at 1am UTC
workflow_dispatch:

concurrency: crowdin-dev
Expand All @@ -20,6 +22,13 @@ jobs:
node-version: 18
cache: yarn

- name: Set date environment variables
run: |
echo "YMDHM=$(date +%Y-%m-%d-%H-%M)" >> $GITHUB_ENV
echo "YMDH=$(date +%Y-%m-%d-%H)" >> $GITHUB_ENV
echo "YMD=$(date +%Y-%m-%d)" >> $GITHUB_ENV
echo "YM=$(date +%Y-%m)" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v3
with:
Expand All @@ -41,7 +50,13 @@ jobs:
uses: actions/cache/restore@v3
with:
path: _crowdin
key: crowdin-cache-${{ github.ref_name }}
key: crowdin-cache-${{ github.ref_name }}-${{ env.YMDHM }}
restore-keys: |
crowdin-cache-${{ github.ref_name }}-${{ env.YMDHM }}
crowdin-cache-${{ github.ref_name }}-${{ env.YMDH }}
crowdin-cache-${{ github.ref_name }}-${{ env.YMD }}
crowdin-cache-${{ github.ref_name }}-${{ env.YM }}
crowdin-cache-${{ github.ref_name }}
- name: Run pre-Crowdin script for file preparation
run: yarn workspace @starknet-io/cms-scripts pre-crowdin
Expand All @@ -62,4 +77,4 @@ jobs:
uses: actions/cache/save@v3
with:
path: _crowdin
key: crowdin-cache-${{ github.ref_name }}
key: crowdin-cache-${{ github.ref_name }}-${{ env.YMDHM }}
13 changes: 10 additions & 3 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ jobs:
uses: actions/cache/restore@v3
with:
path: _crowdin
key: crowdin-cache-dev
key: crowdin-cache-${{ github.ref_name }}-${{ env.YMDHM }}
restore-keys: |
crowdin-cache-${{ github.ref_name }}-${{ env.YMDHM }}
crowdin-cache-${{ github.ref_name }}-${{ env.YMDH }}
crowdin-cache-${{ github.ref_name }}-${{ env.YMD }}
crowdin-cache-${{ github.ref_name }}-${{ env.YM }}
crowdin-cache-${{ github.ref_name }}
crowdin-cache-
- name: Restore social media data
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -86,6 +93,6 @@ jobs:
projectName: starknet-website
directory: dist/client
workingDirectory: workspaces/website
wranglerVersion: '3'
wranglerVersion: "3"
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref_name == 'production' && 'main' || github.ref_name }}
branch: ${{ github.ref_name == 'production' && 'main' || github.ref_name }}
12 changes: 7 additions & 5 deletions workspaces/cms-scripts/src/crowdin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,13 @@ export function handleFields(
break;

case "markdown":
files.push({
type: "markdown",
data: data[field.name],
filepath: filepath + "_" + field.name,
});
if(data[field.name] != null){
files.push({
type: "markdown",
data: data[field.name],
filepath: filepath + "_" + field.name,
});
}
break;

case "list":
Expand Down

0 comments on commit 2b8ec1f

Please sign in to comment.