From c09c47112365e95b88a2ecfee9c0f57e56967db0 Mon Sep 17 00:00:00 2001 From: lorcan-codes <126797224+lorcan-codes@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:40:40 +0500 Subject: [PATCH] Use env values for education videos (#1474) * Use env values for education videos * add video env in pipeline * use secrets in pipeline * add deployment to old org --------- Co-authored-by: bgharbi --- .github/workflows/website.yml | 4 + .github/workflows/website_old.yml | 83 +++++++++++++++++++ .../src/components/VideoPlayer/constants.ts | 8 +- 3 files changed, 91 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/website_old.yml diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index ee48cfd804..6642468cef 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -65,6 +65,10 @@ jobs: VITE_ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} VITE_ALGOLIA_SEARCH_API_KEY: ${{ secrets.ALGOLIA_SEARCH_API_KEY }} VITE_CF_STREAM_URL: ${{ secrets.NEW_CF_STREAM_URL }} + VITE_ED_VIDEO_ID_1: ${{ secrets.NEW_VITE_ED_VIDEO_ID_1 }} + VITE_ED_VIDEO_ID_2: ${{ secrets.NEW_VITE_ED_VIDEO_ID_2 }} + VITE_ED_VIDEO_ID_3: ${{ secrets.NEW_VITE_ED_VIDEO_ID_3 }} + VITE_ED_VIDEO_ID_4: ${{ secrets.NEW_VITE_ED_VIDEO_ID_4 }} - name: Publish uses: cloudflare/pages-action@v1 diff --git a/.github/workflows/website_old.yml b/.github/workflows/website_old.yml new file mode 100644 index 0000000000..940f681932 --- /dev/null +++ b/.github/workflows/website_old.yml @@ -0,0 +1,83 @@ +name: Build and Deploy Starknet Website + +on: + push: + +jobs: + build: + name: Build and Deploy + environment: + name: Starknet Website ${{ github.ref_name }} + url: https://${{ env.GITHUB_REF_SLUG_URL }}.starknet-website.pages.dev + 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: Inject slug/short variables + uses: rlespinasse/github-slug-action@v4 + with: + slug-maxlength: 28 + + - name: Set VITE_SITE_URL + run: | + if [ "${{ env.GITHUB_REF_SLUG_URL }}" = "production" ]; then + echo "VITE_SITE_URL=https://www.starknet.io" >> $GITHUB_ENV + else + echo "VITE_SITE_URL=https://${{ env.GITHUB_REF_SLUG_URL }}.starknet-website.pages.dev" >> $GITHUB_ENV + fi + + - name: Build project + run: yarn workspace @starknet-io/website build + env: + VITE_ALGOLIA_INDEX: ${{ github.ref_name == 'production' && 'production' || 'dev' }} + VITE_ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} + VITE_ALGOLIA_SEARCH_API_KEY: ${{ secrets.ALGOLIA_SEARCH_API_KEY }} + VITE_CF_STREAM_URL: ${{ secrets.CF_STREAM_URL }} + VITE_ED_VIDEO_ID_1: ${{ secrets.VITE_ED_VIDEO_ID_1 }} + VITE_ED_VIDEO_ID_2: ${{ secrets.VITE_ED_VIDEO_ID_2 }} + VITE_ED_VIDEO_ID_3: ${{ secrets.VITE_ED_VIDEO_ID_3 }} + VITE_ED_VIDEO_ID_4: ${{ secrets.VITE_ED_VIDEO_ID_4 }} + + - name: Publish + uses: cloudflare/pages-action@v1 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: starknet-website + directory: dist/client + workingDirectory: workspaces/website + wranglerVersion: '3' + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref_name == 'production' && 'main' || github.ref_name }} diff --git a/workspaces/website/src/components/VideoPlayer/constants.ts b/workspaces/website/src/components/VideoPlayer/constants.ts index 6aadda5fe0..bde611d20f 100644 --- a/workspaces/website/src/components/VideoPlayer/constants.ts +++ b/workspaces/website/src/components/VideoPlayer/constants.ts @@ -12,7 +12,7 @@ export const playlist: Chapter[] = [ title: "How Starknet scales Ethereum", description: "Chapter 1 explains how Starknet works at a high level", thumbnail: "/assets/video/chapter1.png", - videoId: "2805da1fb7f9cd49888f680c26e386fd", + videoId: import.meta.env.VITE_ED_VIDEO_ID_1, durationTime: "02:42", }, { @@ -20,7 +20,7 @@ export const playlist: Chapter[] = [ title: "The Starknet Sequencer", description: "Chapter 2 explains about the Starknet Sequencer", thumbnail: "/assets/video/chapter2.png", - videoId: "47d80010706a05bc4e4dae6cdd43b8be", + videoId: import.meta.env.VITE_ED_VIDEO_ID_2, durationTime: "02:24", }, { @@ -28,7 +28,7 @@ export const playlist: Chapter[] = [ title: "The Starknet Prover", description: "Chapter 3 explains how the Starknet Prover works", thumbnail: "/assets/video/chapter3.png", - videoId: "a23465bbd7c3b27489a29abf4373a55d", + videoId: import.meta.env.VITE_ED_VIDEO_ID_3, durationTime: "02:26", }, { @@ -36,7 +36,7 @@ export const playlist: Chapter[] = [ title: "Secure settlement on Ethereum", description: "Chapter 4 explains how to secure settlement on Ethereum", thumbnail: "/assets/video/chapter4.png", - videoId: "69ba2bd9bdd2ba2970c0fbe3b75c3ec0", + videoId: import.meta.env.VITE_ED_VIDEO_ID_4, durationTime: "03:28", }, ];