diff --git a/.github/actions/deps-setup/action.yml b/.github/actions/deps-setup/action.yml new file mode 100644 index 00000000..55a6cd54 --- /dev/null +++ b/.github/actions/deps-setup/action.yml @@ -0,0 +1,20 @@ +name: Setup +description: Checkout and Install dependencies with cache on the project under template/ +inputs: + working_directory: + description: 'The directory where the install command will be run' + required: true + type: string +runs: + using: composite + steps: + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'yarn' + cache-dependency-path: ${{ inputs.working_directory }}/yarn.lock + - name: Install dependencies + run: yarn install --frozen-lockfile + shell: bash + working-directory: ${{ inputs.working_directory }} diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml deleted file mode 100644 index 9b370d88..00000000 --- a/.github/actions/install-dependencies/action.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: Install dependencies -description: Install dependencies on the project under template/ -runs: - using: composite - steps: - - run: cd template && yarn install - shell: bash diff --git a/.github/workflows/boilerplate-checks.yml b/.github/workflows/boilerplate-checks.yml new file mode 100644 index 00000000..396e1475 --- /dev/null +++ b/.github/workflows/boilerplate-checks.yml @@ -0,0 +1,34 @@ +name: Boilerplate => Eslint, Prettier and Jest tests + +on: + pull_request: + branches: [ main ] + paths: + - template/**/* + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + lint_type_test: + name: Run eslint, prettier, type check and jest tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/deps-setup + with: + working_directory: ./template + - name: Run Eslint + run: yarn lint + working-directory: ./template + - name: Run Typescript check + run: yarn type-check + working-directory: ./template + - name: Run Jest tests + run: yarn test + working-directory: ./template diff --git a/.github/workflows/boilerplate-release.yml b/.github/workflows/boilerplate-release.yml new file mode 100644 index 00000000..5d436c5c --- /dev/null +++ b/.github/workflows/boilerplate-release.yml @@ -0,0 +1,32 @@ +name: Release new boilerplate version + +on: + release: + types: [published] + +jobs: + publish: + if: "!github.event.release.prerelease" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.target_commitish }} + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM }} + - run: | + git config --global user.name "ReactNativeBoilerplate Bot" + git config --global user.email "j.dolle.bot@thecodingmachine.com" + npm --no-git-tag-version version ${{ github.event.release.name }} + - name: Commit and push + run: | + git add . + git commit -am "bump(version): tag boilerplate to version ${{ github.event.release.name }}" + git push + env: + github-token: ${{ secrets.GITHUB }} diff --git a/.github/workflows/cd-npm.yml b/.github/workflows/cd-npm.yml deleted file mode 100644 index 3f598dfb..00000000 --- a/.github/workflows/cd-npm.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: CD workflow to NPM publish - -on: - release: - types: [published] - -jobs: - publish: - if: "!github.event.release.prerelease" - uses: ./.github/workflows/w-deploy-npm.yml - with: - checkout_ref: ${{ github.event.release.target_commitish }} - tag: ${{ github.event.release.name }} - secrets: - NPM: ${{ secrets.NPM_TOKEN }} - GITHUB: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci-develop-next-main.yml b/.github/workflows/ci-develop-next-main.yml deleted file mode 100644 index ac1b4c32..00000000 --- a/.github/workflows/ci-develop-next-main.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: CI - Develop/Next/Main - -on: - pull_request: - branches: [ develop, next, main ] - paths: - - template/**/* - -jobs: - run_lint: - uses: ./.github/workflows/w-run-linters.yml - run_test: - if: ${{ success() }} - uses: ./.github/workflows/w-run-tests.yml - needs: [ run_lint ] diff --git a/.github/workflows/ci-documentation.yml b/.github/workflows/ci-documentation.yml deleted file mode 100644 index bf15e488..00000000 --- a/.github/workflows/ci-documentation.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: CI - Documentation - -on: - pull_request: - branches: [ main ] - paths: - - documentation/**/* - - template/theme/**/* - - template/package.json - -jobs: - check_build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: '19.x' - - name: Test Build - run: | - cd documentation - yarn install --frozen-lockfile - rm -rf .docusaurus/ - npm run build diff --git a/.github/workflows/documentation-checks.yml b/.github/workflows/documentation-checks.yml new file mode 100644 index 00000000..b06807a9 --- /dev/null +++ b/.github/workflows/documentation-checks.yml @@ -0,0 +1,40 @@ +name: Documentation => EsLint, Typescript check and build + +on: + pull_request: + branches: [ main ] + paths: + - documentation/**/* + - template/theme/**/* + - template/package.json + - template/yarn.lock + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + lint_type_build: + name: Run eslint, prettier, type check and build tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/deps-setup + with: + working_directory: ./documentation + - name: Run Eslint + run: yarn lint + working-directory: ./documentation + - name: Run Typescript check + run: yarn type-check + working-directory: ./documentation + - name: Remove previous build + run: rm -rf .docusaurus/ + working-directory: ./documentation + - name: Build documentation + run: yarn build + working-directory: ./documentation diff --git a/.github/workflows/cd-documentation.yml b/.github/workflows/documentation-release.yml similarity index 82% rename from .github/workflows/cd-documentation.yml rename to .github/workflows/documentation-release.yml index 0f3a8493..4ad0019c 100644 --- a/.github/workflows/cd-documentation.yml +++ b/.github/workflows/documentation-release.yml @@ -1,4 +1,4 @@ -name: CD - Documentation +name: Deploy Documentation to GitHub Pages on: push: @@ -12,10 +12,12 @@ jobs: deploy_doc: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: '19.x' + node-version: '20.x' + cache: 'yarn' + cache-dependency-path: ./documentation/yarn.lock - name: Add key to allow access to repository env: SSH_AUTH_SOCK: /tmp/ssh_agent.sock diff --git a/.github/workflows/w-deploy-npm.yml b/.github/workflows/w-deploy-npm.yml deleted file mode 100644 index f30a84ec..00000000 --- a/.github/workflows/w-deploy-npm.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: CD workflow to NPM publish - -on: - workflow_call: - inputs: - checkout_ref: - type: string - required: true - tag: - type: string - required: true - secrets: - NPM: - required: true - GITHUB: - required: true - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: ${{ inputs.checkout_ref }} - - uses: actions/setup-node@v1 - with: - node-version: '19.x' - - run: | - git config --global user.name "RNB Bot" - git config --global user.email "jeremy.dolle34@gmail.com" - npm --no-git-tag-version version ${{ inputs.tag }} - - name: Install dependencies - run: | - if [ -e yarn.lock ]; then - yarn install --frozen-lockfile - fi - - uses: JS-DevTools/npm-publish@v1 - with: - token: ${{ secrets.NPM }} - - name: Commit and push - run: | - git add . - git commit -am "🏷️(version) Update boilerplate to version ${{ inputs.tag }}" - git push - env: - github-token: ${{ secrets.GITHUB }} diff --git a/.github/workflows/w-run-linters.yml b/.github/workflows/w-run-linters.yml deleted file mode 100644 index 452c3e71..00000000 --- a/.github/workflows/w-run-linters.yml +++ /dev/null @@ -1,14 +0,0 @@ -on: - workflow_call: - -jobs: - lint: - name: Run Prettier and ESLint rules checking - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-dependencies - - name: Run linters - run: | - cd template - yarn lint diff --git a/.github/workflows/w-run-tests.yml b/.github/workflows/w-run-tests.yml deleted file mode 100644 index 6f784edc..00000000 --- a/.github/workflows/w-run-tests.yml +++ /dev/null @@ -1,14 +0,0 @@ -on: - workflow_call: - -jobs: - lint: - name: Run and verify jest tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-dependencies - - name: Run tests - run: | - cd template - yarn test diff --git a/documentation/package.json b/documentation/package.json index c39bfed6..5eabdad8 100644 --- a/documentation/package.json +++ b/documentation/package.json @@ -13,7 +13,7 @@ "lint": "eslint . --ext .js,.ts,.jsx,.tsx", "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", - "typecheck": "tsc" + "type-check": "tsc" }, "dependencies": { "@docusaurus/core": "3.1.1", @@ -40,7 +40,7 @@ "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-react": "^7.28.0", "eslint-plugin-react-hooks": "^4.3.0", - "postcss": "^8.4.21", + "postcss": "^8.4.35", "tailwindcss": "^3.2.7", "typescript": "^5.3.3" }, diff --git a/documentation/yarn.lock b/documentation/yarn.lock index 20a6c1be..381141b3 100644 --- a/documentation/yarn.lock +++ b/documentation/yarn.lock @@ -8848,7 +8848,7 @@ postcss@^8.0.9, postcss@^8.4.17, postcss@^8.4.21: picocolors "^1.0.0" source-map-js "^1.0.2" -postcss@^8.4.26, postcss@^8.4.33: +postcss@^8.4.26, postcss@^8.4.33, postcss@^8.4.35: version "8.4.35" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.35.tgz#60997775689ce09011edf083a549cea44aabe2f7" integrity sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA== diff --git a/template/.env b/template/.env index 09155293..66aba81b 100644 --- a/template/.env +++ b/template/.env @@ -1 +1,2 @@ API_URL: https://jsonplaceholder.typicode.com +