Push and publish main #2314
This file contains hidden or 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: Push and publish main | |
on: | |
schedule: | |
# twice a day at midnight and noon UTC | |
- cron: '0 0,12 * * *' | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: publish | |
jobs: | |
# Make a reusable workflow | |
crowdin-upload: | |
name: Upload to Crowdin | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag: v4.2.2 | |
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # tag: v4.4.0 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Upload sources to Crowdin | |
run: 'yarn i18n:upload' | |
env: | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
build-and-deploy: | |
name: Build and deploy the website | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
steps: | |
- name: Set GIT_BRANCH | |
run: echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- name: Print GIT_BRANCH | |
run: echo $GIT_BRANCH | |
- name: Print content | |
run: ls -ln | |
# This should be set up from earlier | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag: v4.2.2 | |
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # tag: v4.4.0 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Lint | |
run: yarn lint | |
env: | |
CI: true | |
- name: Docusaurus Cache | |
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # tag: v4.2.3 | |
with: | |
path: | | |
${{ github.workspace }}/.docusaurus | |
${{ github.workspace }}/**/.cache | |
key: | | |
${{ runner.os }}-docusaurus-v2-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
restore-keys: | | |
${{ runner.os }}-docusaurus-v2-${{ hashFiles('**/yarn.lock') }} | |
- name: Add Docusaurus problem matcher | |
run: echo "::add-matcher::.github/problem-matchers/docusaurus.json" | |
- name: Build default locale site | |
run: yarn build | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sync build directory to Azure Blob Storage | |
uses: nick-invision/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # tag: v3.0.2 | |
with: | |
timeout_seconds: 3000 | |
max_attempts: 3 | |
retry_on: error | |
# Ensure that we upload the default locale and remove deleted files but don't touch translations | |
command: cd ./build && ../scripts/bin/azcopy sync "./" "https://electronwebsite.blob.core.windows.net/%24web/?$SAS" --exclude-path="de/;es/;fr/;ja/;pt/;ru/;zh/;" --compare-hash=MD5 | |
env: | |
SAS: ${{ secrets.SAS }} | |
- name: Upload azcopy debug logs | |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2 | |
with: | |
name: debug-log | |
path: /home/runner/.azcopy/*.log | |
include-hidden-files: true | |
retention-days: 3 |