From 747a15fe6ad9f6939e3cfa1fc431a28436a706ee Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra Date: Fri, 29 Mar 2024 13:34:00 +0530 Subject: [PATCH] feat: add build actions --- .github/crowdin-download.docs.yml | 265 ------------------------------ .github/crowdin-upload.docs.yml | 50 ------ .github/workflows/build.yml | 64 ++++++++ 3 files changed, 64 insertions(+), 315 deletions(-) delete mode 100644 .github/crowdin-download.docs.yml delete mode 100644 .github/crowdin-upload.docs.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/crowdin-download.docs.yml b/.github/crowdin-download.docs.yml deleted file mode 100644 index 485fc1fb..00000000 --- a/.github/crowdin-download.docs.yml +++ /dev/null @@ -1,265 +0,0 @@ -name: i18n - Download Docs -on: - workflow_dispatch: - # schedule: - # runs Monday and Wednesday at 12:15 PM UTC - # - cron: '15 12 * * 1,3' - -env: - GITHUB_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_PAT }} - CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_DOCS }} - CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }} - CROWDIN_API_URL: 'https://freecodecamp.crowdin.com/api/v2/' - -jobs: - i18n-download-docs-translations: - name: Docs - runs-on: ubuntu-22.04 - - steps: - - name: Checkout Source Files - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - with: - token: ${{ secrets.CROWDIN_CAMPERBOT_PAT }} - - - name: Generate Crowdin Config - uses: freecodecamp/crowdin-action@main - env: - PLUGIN: 'generate-config' - PROJECT_NAME: 'docs' - - ##### Download Chinese ##### - - name: Crowdin Download Chinese Translations - uses: crowdin/github-action@master - # options: https://github.com/crowdin/github-action/blob/master/action.yml - with: - # uploads - upload_sources: false - upload_translations: false - auto_approve_imported: false - import_eq_suggestions: false - - # downloads - download_translations: true - download_language: zh-CN - skip_untranslated_files: false - export_only_approved: true - - push_translations: false - - # pull-request - create_pull_request: false - - # global options - config: './crowdin-config.yml' - base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }} - - # Uncomment below to debug - # dryrun_action: true - - # Convert Simplified Chinese to Traditional # - - name: Convert Chinese - uses: freecodecamp/crowdin-action@main - env: - PLUGIN: 'convert-chinese' - FILE_PATHS: '["/docs/i18n/chinese/"]' - - ##### Download Portuguese##### - - name: Crowdin Download Portuguese Translations - uses: crowdin/github-action@master - # options: https://github.com/crowdin/github-action/blob/master/action.yml - with: - # uploads - upload_sources: false - upload_translations: false - auto_approve_imported: false - import_eq_suggestions: false - - # downloads - download_translations: true - download_language: pt-BR - skip_untranslated_files: false - export_only_approved: true - - push_translations: false - - # pull-request - create_pull_request: false - - # global options - config: './crowdin-config.yml' - base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }} - - # Uncomment below to debug - # dryrun_action: true - - ##### Download Espanol ##### - - name: Crowdin Espanol Download Translations - uses: crowdin/github-action@master - # options: https://github.com/crowdin/github-action/blob/master/action.yml - with: - # uploads - upload_sources: false - upload_translations: false - auto_approve_imported: false - import_eq_suggestions: false - - # downloads - download_translations: true - download_language: es-EM - skip_untranslated_files: false - export_only_approved: true - - push_translations: false - - # pull-request - create_pull_request: false - - # global options - config: './crowdin-config.yml' - base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }} - - # Uncomment below to debug - # dryrun_action: true - - ##### Download Italian ##### - - name: Crowdin Download Italian Translations - uses: crowdin/github-action@master - # options: https://github.com/crowdin/github-action/blob/master/action.yml - with: - # uploads - upload_sources: false - upload_translations: false - auto_approve_imported: false - import_eq_suggestions: false - - # downloads - download_translations: true - download_language: it - skip_untranslated_files: false - export_only_approved: true - - push_translations: false - - # pull-request - create_pull_request: false - - # global options - config: './crowdin-config.yml' - base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }} - - # Uncomment below to debug - # dryrun_action: true - - ##### Download Japanese ##### - - name: Crowdin Download Japanese Translations - uses: crowdin/github-action@master - # options: https://github.com/crowdin/github-action/blob/master/action.yml - with: - # uploads - upload_sources: false - upload_translations: false - auto_approve_imported: false - import_eq_suggestions: false - - # downloads - download_translations: true - download_language: ja - skip_untranslated_files: false - export_only_approved: true - - push_translations: false - - # pull-request - create_pull_request: false - - # global options - config: './crowdin-config.yml' - base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }} - - # Uncomment below to debug - # dryrun_action: true - - ##### Download Ukrainian ##### - - name: Crowdin Download Ukrainian Translations - uses: crowdin/github-action@master - # options: https://github.com/crowdin/github-action/blob/master/action.yml - with: - # uploads - upload_sources: false - upload_translations: false - auto_approve_imported: false - import_eq_suggestions: false - - # downloads - download_translations: true - download_language: uk - skip_untranslated_files: false - export_only_approved: true - - push_translations: false - - # pull-request - create_pull_request: false - - # global options - config: './crowdin-config.yml' - base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }} - - # Uncomment below to debug - # dryrun_action: true - - ##### Download German ##### - - name: Crowdin Download German Translations - uses: crowdin/github-action@master - # options: https://github.com/crowdin/github-action/blob/master/action.yml - with: - # uploads - upload_sources: false - upload_translations: false - auto_approve_imported: false - import_eq_suggestions: false - - # downloads - download_translations: true - download_language: de - skip_untranslated_files: false - export_only_approved: true - - push_translations: false - - # pull-request - create_pull_request: false - - # global options - config: './crowdin-config.yml' - base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }} - - # Uncomment below to debug - # dryrun_action: true - - # Create Commit - - name: Commit Changes - uses: freecodecamp/crowdin-action@main - env: - PLUGIN: 'commit-changes' - GH_USERNAME: 'camperbot' - GH_EMAIL: ${{ secrets.ACTIONS_CAMPERBOT_EMAIL }} - GH_BRANCH: 'i18n-sync-docs' - GH_MESSAGE: 'chore(i18n,docs): processed translations' - - # Generate PR # - # All languages should go ABOVE this. # - - - name: Create PR - uses: freecodecamp/crowdin-action@main - env: - PLUGIN: 'pull-request' - GH_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_PAT }} - BRANCH: 'i18n-sync-docs' - REPOSITORY: 'freecodecamp/freecodecamp' - BASE: 'main' - TITLE: 'chore(i18n,docs): processed translations' - BODY: 'This PR was opened auto-magically by Crowdin.' - LABELS: 'crowdin-sync' - TEAM_REVIEWERS: 'i18n' diff --git a/.github/crowdin-upload.docs.yml b/.github/crowdin-upload.docs.yml deleted file mode 100644 index f01adfee..00000000 --- a/.github/crowdin-upload.docs.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: i18n - Upload Docs -on: - workflow_dispatch: - # schedule: - # runs every weekday at 11:00 AM UTC - # - cron: '0 11 * * 1-5' - -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }} - CROWDIN_API_URL: 'https://freecodecamp.crowdin.com/api/v2/' - CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_DOCS }} - -jobs: - i18n-upload-docs-files: - name: Docs - runs-on: ubuntu-22.04 - - steps: - - name: Checkout Source Files - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - - name: Generate Crowdin Config - uses: freecodecamp/crowdin-action@main - env: - PLUGIN: 'generate-config' - PROJECT_NAME: 'docs' - - - name: Crowdin Upload - uses: crowdin/github-action@master - # options: https://github.com/crowdin/github-action/blob/master/action.yml - with: - # uploads - upload_sources: true - upload_translations: false - auto_approve_imported: false - import_eq_suggestions: false - - # downloads - download_translations: false - - # pull-request - create_pull_request: false - - # global options - config: './crowdin-config.yml' - base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }} - - # Uncomment below to debug - # dryrun_action: true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..8f0039be --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,64 @@ +name: Build Check + +on: + push: + branches: + - main + - live + pull_request: + types: [opened, synchronize, reopened] + workflow_dispatch: + +jobs: + # lint: + # test: + build: + name: Build + runs-on: ubuntu-latest + # needs: test + + env: + CI: true + + strategy: + matrix: + node-version: [20.x] + + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install pnpm + uses: pnpm/action-setup@v2 + id: pnpm-install + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Cache + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + with: + path: | + ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + + - name: Install dependencies + run: | + pnpm install --frozen-lockfile + + - name: Build + run: | + pnpm build