Skip to content

Commit

Permalink
refactor(ci): simplify ci
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyDolle committed Feb 27, 2024
1 parent 126b2ba commit 28dc9c7
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 33 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/boilerplate-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 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:
- uses: ./.github/workflows/deps-setup.yml
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
32 changes: 32 additions & 0 deletions .github/workflows/boilerplate-release.yml
Original file line number Diff line number Diff line change
@@ -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 "[email protected]"
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 }}
24 changes: 24 additions & 0 deletions .github/workflows/deps-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
workflow_call:
inputs:
working_directory:
description: 'The directory where the install command will be run'
required: true
type: string

jobs:
setup:
name: Install dependencies with cache
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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
working-directory: ${{ inputs.working_directory }}
38 changes: 38 additions & 0 deletions .github/workflows/documentation-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Documentation linters 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:
- uses: ./.github/workflows/deps-setup.yml
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
46 changes: 46 additions & 0 deletions .github/workflows/documentation-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy Documentation to GitHub Pages

on:
push:
branches: [ main ]
paths:
- documentation/**/*
- template/theme/**/*
- template/package.json

jobs:
deploy_doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
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
run: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
cat <<EOT >> ~/.ssh/config
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa
EOT
- name: Release to GitHub Pages
env:
USE_SSH: true
GIT_USER: git
DEPLOYMENT_BRANCH: gh-pages
run: |
git config --global user.email "[email protected]"
git config --global user.name "gh-actions"
cd documentation
yarn install --frozen-lockfile
rm -rf .docusaurus/
yarn build
yarn deploy
30 changes: 0 additions & 30 deletions .github/workflows/mobile-lint.yml

This file was deleted.

4 changes: 2 additions & 2 deletions documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion documentation/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==
Expand Down

0 comments on commit 28dc9c7

Please sign in to comment.