chore: Update account copy #793
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Frontend | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- sandbox | |
paths: | |
- '.github/workflows/frontend.yml' | |
- 'shared/**' | |
- 'frontend/config/**' | |
- 'frontend/apps/crates/components/**' | |
- 'frontend/apps/crates/utils/**' | |
- 'frontend/apps/crates/entry/admin/**' | |
- 'frontend/apps/crates/entry/home/**' | |
- 'frontend/apps/crates/entry/asset/**' | |
- 'frontend/apps/crates/entry/user/**' | |
- 'frontend/apps/crates/entry/community/**' | |
- 'frontend/apps/crates/entry/kids/**' | |
- 'frontend/apps/crates/entry/classroom/**' | |
- 'frontend/apps/crates/entry/module/**' | |
- 'frontend/ts-utils/**' | |
- 'frontend/elements/**' | |
- 'frontend/apps/static/**' | |
jobs: | |
prepare: | |
name: Prepare | |
runs-on: ubuntu-22.04 | |
outputs: | |
branch: "${{ steps.branch.outputs.value }}" | |
steps: | |
- name: Get branch from ref | |
id: branch | |
run: echo "value=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
check-and-test: | |
needs: [prepare] | |
name: "[${{ needs.prepare.outputs.branch }}] Check" | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: -D warnings | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
# toolchain: nightly | |
toolchain: nightly-2023-06-08 | |
components: rustfmt | |
- run: cargo check --all --manifest-path frontend/apps/Cargo.toml | |
- run: cargo fmt --all --manifest-path frontend/apps/Cargo.toml --check | |
- run: cargo test --all --manifest-path frontend/apps/Cargo.toml | |
build-app: | |
needs: [prepare] | |
name: "[${{ needs.prepare.outputs.branch }}] Build - App (${{matrix.app}})" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: [admin, home, asset/edit, asset/play, community, user, kids, classroom] | |
steps: | |
- name: "Set environment" | |
env: | |
BRANCH: ${{ needs.prepare.outputs.branch }} | |
run: | | |
if [[ ${BRANCH} == 'master' ]]; then | |
echo "ENVIRONMENT=release" >> $GITHUB_ENV | |
echo "MIXPANEL_PROJECT_TOKEN=${{ secrets.MIXPANEL_PROJECT_TOKEN_RELEASE }}" >> $GITHUB_ENV | |
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY }}" >> $GITHUB_ENV | |
echo "STORAGE_BUCKET=ji-cloud-frontend-origin-eu-001" >> $GITHUB_ENV | |
else | |
echo "ENVIRONMENT=sandbox" >> $GITHUB_ENV | |
echo "MIXPANEL_PROJECT_TOKEN=${{ secrets.MIXPANEL_PROJECT_TOKEN_SANDBOX }}" >> $GITHUB_ENV | |
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY_SANDBOX }}" >> $GITHUB_ENV | |
echo "STORAGE_BUCKET=ji-cloud-sandbox-frontend-origin-eu-001" >> $GITHUB_ENV | |
fi | |
- uses: actions/checkout@v3 | |
- name: Extract label | |
shell: bash | |
run: echo "value=\"[${{needs.prepare.outputs.branch}} - module/${{ matrix.app }} - app]\"" >> $GITHUB_OUTPUT | |
id: extract_label | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
# toolchain: nightly | |
toolchain: nightly-2023-06-08 | |
- uses: davidB/rust-cargo-make@master | |
- name: install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: install npm deps | |
run: npm ci | |
working-directory: "./frontend/apps" | |
- name: install npm deps (build-utils) | |
run: npm ci | |
working-directory: "./frontend/build-utils" | |
- name: build | |
run: cargo make ${{ env.ENVIRONMENT }} "${{ matrix.app }}" | |
working-directory: "./frontend/apps" | |
env: | |
LOCAL_CDN_FRONTEND_DIR: ${{ github.workspace }}/frontend | |
MIXPANEL_PROJECT_TOKEN: ${{ env.MIXPANEL_PROJECT_TOKEN }} | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ env.GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY }}' | |
- name: install google cloud sdk | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: deploy to google cloud | |
# run: gsutil -m rsync -d -r frontend/apps/dist/${{ matrix.app }}/js gs://${{ env.STORAGE_BUCKET }}/${{ matrix.app }}/js | |
run: gsutil -m cp -Z -r frontend/apps/dist/${{ matrix.app }}/js gs://${{ env.STORAGE_BUCKET }}/${{ matrix.app }} | |
build-module: | |
needs: [prepare] | |
name: "[${{ needs.prepare.outputs.branch }}] Build - Module (${{matrix.app}}, ${{matrix.mode}})" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: [poster, video, embed, tapping-board, drag-drop, memory, matching, flashcards, card-quiz, cover, resource-cover, legacy, find-answer] | |
mode: [edit, play] | |
steps: | |
- name: "Set environment" | |
env: | |
BRANCH: ${{ needs.prepare.outputs.branch }} | |
run: | | |
if [[ ${BRANCH} == 'master' ]]; then | |
echo "ENVIRONMENT=release" >> $GITHUB_ENV | |
echo "MIXPANEL_PROJECT_TOKEN=${{ secrets.MIXPANEL_PROJECT_TOKEN_RELEASE }}" >> $GITHUB_ENV | |
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY }}" >> $GITHUB_ENV | |
echo "STORAGE_BUCKET=ji-cloud-frontend-origin-eu-001" >> $GITHUB_ENV | |
else | |
echo "ENVIRONMENT=sandbox" >> $GITHUB_ENV | |
echo "MIXPANEL_PROJECT_TOKEN=${{ secrets.MIXPANEL_PROJECT_TOKEN_SANDBOX }}" >> $GITHUB_ENV | |
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY_SANDBOX }}" >> $GITHUB_ENV | |
echo "STORAGE_BUCKET=ji-cloud-sandbox-frontend-origin-eu-001" >> $GITHUB_ENV | |
fi | |
- uses: actions/checkout@v3 | |
- name: Extract label | |
shell: bash | |
run: echo "value=\"[${{needs.prepare.outputs.branch}} - module/${{ matrix.app }}/${{ matrix.mode }} - app]\"" >> $GITHUB_OUTPUT | |
id: extract_label | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
# toolchain: nightly | |
toolchain: nightly-2023-06-08 | |
- uses: davidB/rust-cargo-make@master | |
- name: install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: install npm deps | |
run: npm ci | |
working-directory: "./frontend/apps" | |
- name: install npm deps (build-utils) | |
run: npm ci | |
working-directory: "./frontend/build-utils" | |
- name: build | |
run: cargo make ${{ env.ENVIRONMENT }} "module/${{ matrix.app }}/${{ matrix.mode }}" | |
working-directory: "./frontend/apps" | |
env: | |
LOCAL_CDN_FRONTEND_DIR: ${{ github.workspace }}/frontend | |
MIXPANEL_PROJECT_TOKEN: ${{ env.MIXPANEL_PROJECT_TOKEN }} | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ env.GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY }}' | |
- name: install google cloud sdk | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: deploy to google cloud | |
run: gsutil -m rsync -d -r frontend/apps/dist/module/${{ matrix.app }}/${{ matrix.mode }}/js gs://${{ env.STORAGE_BUCKET }}/module/${{ matrix.app }}/${{ matrix.mode }}/js | |
copy-static: | |
needs: [prepare] | |
name: "[${{ needs.prepare.outputs.branch }}] Copy static files" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Set environment" | |
env: | |
BRANCH: ${{ needs.prepare.outputs.branch }} | |
run: | | |
if [[ ${BRANCH} == 'master' ]]; then | |
echo "ENVIRONMENT=release" >> $GITHUB_ENV | |
echo "MIXPANEL_PROJECT_TOKEN=${{ secrets.MIXPANEL_PROJECT_TOKEN_RELEASE }}" >> $GITHUB_ENV | |
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY }}" >> $GITHUB_ENV | |
echo "STORAGE_BUCKET=ji-cloud-frontend-origin-eu-001" >> $GITHUB_ENV | |
else | |
echo "ENVIRONMENT=sandbox" >> $GITHUB_ENV | |
echo "MIXPANEL_PROJECT_TOKEN=${{ secrets.MIXPANEL_PROJECT_TOKEN_SANDBOX }}" >> $GITHUB_ENV | |
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY_SANDBOX }}" >> $GITHUB_ENV | |
echo "STORAGE_BUCKET=ji-cloud-sandbox-frontend-origin-eu-001" >> $GITHUB_ENV | |
fi | |
- uses: actions/checkout@v3 | |
- name: Extract label | |
shell: bash | |
run: echo "value=\"[${{needs.prepare.outputs.branch}} - copy-static]\"" >> $GITHUB_OUTPUT | |
id: extract_label | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ env.GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY }}' | |
- name: install google cloud sdk | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: deploy to google cloud | |
run: gsutil -m rsync -d -r frontend/apps/static gs://${{ env.STORAGE_BUCKET }}/static | |
test: | |
needs: [prepare] | |
name: "[${{ needs.prepare.outputs.branch }}] Test" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Extract label | |
shell: bash | |
run: echo "value=\"[${{needs.prepare.outputs.branch}} - test - elements]\"" >> $GITHUB_OUTPUT | |
id: extract_label | |
- name: install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: install npm deps | |
run: npm ci | |
working-directory: "./frontend/elements" | |
env: | |
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
- name: test elements | |
run: npm run test | |
working-directory: "./frontend/elements" | |
env: | |
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
build-module-elements: | |
runs-on: ubuntu-latest | |
name: "[${{ needs.prepare.outputs.branch }}] Build - Module - Elements (${{matrix.app}}, ${{matrix.mode}})" | |
needs: [prepare, test] | |
strategy: | |
matrix: | |
app: [poster, video, embed, tapping-board, drag-drop, memory, matching, flashcards, card-quiz, cover, resource-cover, find-answer, legacy] | |
mode: [edit, play] | |
steps: | |
- name: "Set environment" | |
env: | |
BRANCH: ${{ needs.prepare.outputs.branch }} | |
run: | | |
if [[ ${BRANCH} == 'master' ]]; then | |
echo "ENVIRONMENT=release" >> $GITHUB_ENV | |
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY }}" >> $GITHUB_ENV | |
echo "STORAGE_BUCKET=ji-cloud-frontend-origin-eu-001" >> $GITHUB_ENV | |
else | |
echo "ENVIRONMENT=sandbox" >> $GITHUB_ENV | |
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY_SANDBOX }}" >> $GITHUB_ENV | |
echo "STORAGE_BUCKET=ji-cloud-sandbox-frontend-origin-eu-001" >> $GITHUB_ENV | |
fi | |
- uses: actions/checkout@v3 | |
- name: Extract label | |
shell: bash | |
run: echo "value=\"[${{needs.prepare.outputs.branch}} - module/${{ matrix.app }}/${{ matrix.mode }} - elements]\"" >> $GITHUB_OUTPUT | |
id: extract_label | |
- name: install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: install npm deps | |
run: npm ci | |
working-directory: "./frontend/elements" | |
env: | |
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
- name: build elements | |
run: npm run build:${{ env.ENVIRONMENT }} | |
working-directory: "./frontend/elements" | |
env: | |
APP_NAME: "module/${{ matrix.app }}/${{ matrix.mode }}" | |
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ env.GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY }}' | |
- name: install google cloud sdk | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: deploy to google cloud | |
run: gsutil -m rsync -d -r frontend/elements/dist/module/${{ matrix.app }}/${{ matrix.mode }} gs://${{ env.STORAGE_BUCKET }}/module/${{ matrix.app }}/${{ matrix.mode }}/elements | |
build-entry-elements: | |
needs: [prepare, test] | |
name: "[${{ needs.prepare.outputs.branch }}] Build - Entry - Elements (${{matrix.app}})" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: [admin, home, asset/edit, asset/play, community, user, kids, classroom] | |
steps: | |
- name: "Set environment" | |
env: | |
BRANCH: ${{ needs.prepare.outputs.branch }} | |
run: | | |
if [[ ${BRANCH} == 'master' ]]; then | |
echo "ENVIRONMENT=release" >> $GITHUB_ENV | |
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY }}" >> $GITHUB_ENV | |
echo "STORAGE_BUCKET=ji-cloud-frontend-origin-eu-001" >> $GITHUB_ENV | |
else | |
echo "ENVIRONMENT=sandbox" >> $GITHUB_ENV | |
echo "GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY=${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_JSON_KEY_SANDBOX }}" >> $GITHUB_ENV | |
echo "STORAGE_BUCKET=ji-cloud-sandbox-frontend-origin-eu-001" >> $GITHUB_ENV | |
fi | |
- uses: actions/checkout@v3 | |
- name: Extract label | |
shell: bash | |
run: echo "value=\"[${{needs.prepare.outputs.branch}} - module/${{ matrix.app }} - elements]\"" >> $GITHUB_OUTPUT | |
id: extract_label | |
- name: install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: install npm deps | |
run: npm ci | |
working-directory: "./frontend/elements" | |
env: | |
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
- name: build elements | |
run: npm run build:${{ env.ENVIRONMENT }} | |
working-directory: "./frontend/elements" | |
env: | |
APP_NAME: "${{ matrix.app }}" | |
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ env.GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY }}' | |
- name: install google cloud sdk | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: deploy to google cloud | |
run: gsutil -m rsync -d -r frontend/elements/dist/${{ matrix.app }} gs://${{ env.STORAGE_BUCKET }}/${{ matrix.app }}/elements |