Skip to content

Commit

Permalink
Update CMS and Crowdin integration with optimized workflows and refac…
Browse files Browse the repository at this point in the history
…tored project structure
  • Loading branch information
thecotne committed Apr 17, 2023
1 parent 185c568 commit d9cf653
Show file tree
Hide file tree
Showing 488 changed files with 9,304 additions and 18,708 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/algolia-index.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/algolia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Algolia Action

on:
push:
paths:
- "_data/**"
- "workspaces/cms-*/**"
- ".github/workflows/algolia.yml"
branches:
- dev
- production

jobs:
update-index:
runs-on: ubuntu-22.04
environment: "dev-algolia-index"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn

- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
.yarn/cache
.yarn/install-state.gz
.eslintcache
**/tsconfig.tsbuildinfo
**/.types/**
**/.types-*/**
key: build-cache-${{ hashFiles('yarn.lock') }}
restore-keys: |
build-cache-
- name: Install dependencies
run: yarn

- name: Update Algolia search index
run: yarn workspace @starknet-io/cms-scripts update-algolia-index
env:
ALGOLIA_INDEX: ${{ github.ref_name }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_API_KEY: ${{ secrets.ALGOLIA_SEARCH_API_KEY }}
ALGOLIA_WRITE_API_KEY: ${{ secrets.ALGOLIA_WRITE_API_KEY }}
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build

on:
push:

jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn

- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
.yarn/cache
.yarn/install-state.gz
.eslintcache
**/tsconfig.tsbuildinfo
**/.types/**
**/.types-*/**
key: build-cache-${{ hashFiles('yarn.lock') }}
restore-keys: |
build-cache-
- name: Install dependencies
run: yarn

- name: Restore Crowdin Cache
uses: actions/cache/restore@v3
with:
path: _crowdin
key: crowdin-cache-dev

- name: Update dynamic data
run: yarn workspace @starknet-io/cms-scripts update-dynamic-data

- name: Build project
run: yarn exec next build
68 changes: 46 additions & 22 deletions .github/workflows/crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,65 @@
name: Crowdin Action

on:
- workflow_dispatch
workflow_dispatch:

concurrency: crowdin-dev

jobs:
synchronize-with-crowdin:
name: Synchronize with Crowdin
environment: "dev-crowdin"

runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn

- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
.yarn/cache
.yarn/install-state.gz
.eslintcache
**/tsconfig.tsbuildinfo
**/.types/**
**/.types-*/**
key: build-cache-${{ hashFiles('yarn.lock') }}
restore-keys: |
build-cache-
# - uses: actions/setup-node@v3
# with:
# node-version: 18
# cache: yarn
# - run: yarn
# - run: yarn workspace content-onedge-workspace pre-crowdin
- name: Install dependencies
run: yarn

- name: crowdin action
uses: crowdin/github-action@v1
- name: Restore Crowdin Cache
uses: actions/cache/restore@v3
with:
upload_sources: true
upload_translations: false
download_translations: true
# download_language: 'de'
localization_branch_name: ${{ github.ref_name }}_l10n
crowdin_branch_name: dev
create_pull_request: true
pull_request_title: "New Crowdin Translations"
pull_request_body: "New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)"
base_url: "https://starkware.crowdin.com"
path: _crowdin
key: crowdin-cache-${{ github.ref_name }}

- name: Run pre-Crowdin script for file preparation
run: yarn workspace @starknet-io/cms-scripts pre-crowdin

- name: Upload source files to Crowdin project
run: yarn crowdin upload -b ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

- name: Download approved translations from Crowdin
run: yarn crowdin download -b ${{ github.ref_name }} --export-only-approved --skip-untranslated-strings
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

- name: Save Crowdin Cache
uses: actions/cache/save@v3
with:
path: _crowdin
key: crowdin-cache-${{ github.ref_name }}
48 changes: 48 additions & 0 deletions .github/workflows/netlify-cms-auth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build and Deploy Netlify CMS Auth

on:
push:
branches:
- deploy/netlify-cms-auth

jobs:
build_and_deploy:
name: Build and Deploy
environment: "netlify-cms-auth"
permissions:
contents: read
deployments: write
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn

- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
.yarn/cache
.yarn/install-state.gz
.eslintcache
**/tsconfig.tsbuildinfo
**/.types/**
**/.types-*/**
key: build-cache-${{ hashFiles('yarn.lock') }}
restore-keys: |
build-cache-
- name: Install dependencies
run: yarn

- name: Publish
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: workspaces/netlify-cms-auth
command: publish
55 changes: 55 additions & 0 deletions .github/workflows/netlify-cms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build and Deploy Netlify CMS

on:
push:

jobs:
build-and-deploy:
name: Build and Deploy
environment: "netlify-cms"
permissions:
contents: read
deployments: write
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn

- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
.yarn/cache
.yarn/install-state.gz
.eslintcache
**/tsconfig.tsbuildinfo
**/.types/**
**/.types-*/**
key: build-cache-${{ hashFiles('yarn.lock') }}
restore-keys: |
build-cache-
- name: Install dependencies
run: yarn

- name: Build Netlify CMS
run: yarn workspace @starknet-io/netlify-cms build
env:
VITE_GIT_BRANCH_NAME: ${{ github.ref_name }}
# TODO update this once CORS updates land on prod
VITE_API_BASE_URL: https://starknet-website-git-tsotne-wip2-yuki-labs.vercel.app/api

- name: Deploy Netlify CMS
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: starknet-netlify-cms
directory: workspaces/netlify-cms/dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref_name }}
2 changes: 2 additions & 0 deletions .github/workflows/pr-dev-to-production.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Open PR to merge dev into production

on:
push:
branches:
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,11 @@ next-env.d.ts
.netlify

#vscode
.vscode/settings.json
.vscode/settings.json

.types
.types-*
_crowdin
*.vars
*.__*
dist
Loading

0 comments on commit d9cf653

Please sign in to comment.