From ebc8d7f71068c4fb593de39f23d10c4937101d1b Mon Sep 17 00:00:00 2001 From: Ron de las Alas Date: Wed, 4 Oct 2023 09:54:48 -0400 Subject: [PATCH 1/4] chore: add nvmrc file --- .nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..6f7f377b --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16 From ba540be72d9c5c2c6d90e82bbd398f04b07f8678 Mon Sep 17 00:00:00 2001 From: Ron de las Alas Date: Wed, 4 Oct 2023 14:46:58 -0400 Subject: [PATCH 2/4] ci: add github actions file --- .github/workflows/deploy.yml | 62 ++++++++++++++++++++++++++++++++++++ package.json | 4 +-- 2 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..0e8ee03a --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,62 @@ +name: Scratch Paint CI-CD + +on: + pull_request: # Runs whenever a pull request is created or updated + push: # Runs whenever a commit is pushed to the repository... + branches: [master, develop, hotfix/*] # ...on any of these branches + workflow_dispatch: # Allows you to run this workflow manually from the Actions tab + +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + +permissions: + contents: write + pages: write + issues: write + pull-requests: write + +jobs: + ci-cd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: wagoid/commitlint-github-action@v5 + if: github.event_name == 'pull_request' + - uses: actions/setup-node@v3 + with: + cache: "npm" + node-version-file: ".nvmrc" + - name: Info + run: | + cat < tmp.js && rimraf tmp.js && ./scripts/build-i18n-source.js ./translations/messages/ ./translations/", "lint": "eslint . --ext .js,.jsx", - "prepare": "husky install", "start": "webpack-dev-server", - "test": "npm run lint && npm run unit && NODE_ENV=production npm run build", + "test": "npm run lint && npm run unit", "unit": "jest --reporters=default", "watch": "webpack --progress --colors --watch" }, From 2a75d0ccb1881ee419c2cddda3d3074cbf402d5f Mon Sep 17 00:00:00 2001 From: Ron de las Alas Date: Thu, 5 Oct 2023 14:29:11 -0400 Subject: [PATCH 3/4] ci: sort out the env vars --- .github/workflows/deploy.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0e8ee03a..f0cda1ad 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,7 @@ name: Scratch Paint CI-CD on: pull_request: # Runs whenever a pull request is created or updated push: # Runs whenever a commit is pushed to the repository... - branches: [master, develop, hotfix/*] # ...on any of these branches + branches: [master, develop, beta, hotfix/*] # ...on any of these branches workflow_dispatch: # Allows you to run this workflow manually from the Actions tab concurrency: @@ -19,7 +19,9 @@ permissions: jobs: ci-cd: runs-on: ubuntu-latest - steps: + env: + TRIGGER_DEPLOY: ${{ startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/hotfix') || startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/beta') }} + steps: - uses: actions/checkout@v4 - uses: wagoid/commitlint-github-action@v5 if: github.event_name == 'pull_request' @@ -46,14 +48,14 @@ jobs: env: NODE_ENV: production - name: Deploy playground to GitHub Pages - if: startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/hotfix') + if: ${{ env.TRIGGER_DEPLOY == 'true'}} uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: playground full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}" - name: Semantic Release - if: startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/hotfix') + if: ${{ env.TRIGGER_DEPLOY == 'true'}} env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 880b9169b0c37cba8f9484f86b88f5644df99cc3 Mon Sep 17 00:00:00 2001 From: Ron de las Alas Date: Tue, 10 Oct 2023 11:16:24 -0400 Subject: [PATCH 4/4] ci: add cron job for translations --- .github/workflows/update-l10n.yml | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/update-l10n.yml diff --git a/.github/workflows/update-l10n.yml b/.github/workflows/update-l10n.yml new file mode 100644 index 00000000..90423bc0 --- /dev/null +++ b/.github/workflows/update-l10n.yml @@ -0,0 +1,41 @@ +name: Update i18n + +on: + workflow_dispatch: # Allows you to run this workflow manually from the Actions tab + schedule: + - cron: 0 0 * * * # daily at midnight UTC = 7-8pm US Eastern + +concurrency: + group: '${{ github.workflow }}' + cancel-in-progress: true + +permissions: + contents: write + +jobs: + update-tx: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: 'develop' + - uses: actions/setup-node@v3 + with: + cache: 'npm' + node-version-file: '.nvmrc' + - name: Info + run: | + cat <