From 4db8a4caeb1593fa053f4fd82991b6a3c8ff4b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20HOUZ=C3=89?= Date: Tue, 31 Aug 2021 23:16:27 +0200 Subject: [PATCH] Add github action --- README.md | 27 +++++++++++++++++++++++++-- action.yaml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 action.yaml diff --git a/README.md b/README.md index 73cab9e..82bc57b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ -# setup-monorepo-node-app -Prepare everything needed for a Nodejs app in a monorepo (cache, dependencies, ...) +# Setup monorepo node app + +Setup a node app in a monorepo: + 1. Sparse checkout the monorepo directory of the Nodejs app + 2. Setup Nodejs required version + 2. Install dependencies thanks to yarn2 + +## Inputs + +### `node-version` + +**Required** Nodejs version. Default `"14"`. + +### `working-directory` + +**Required** Directory of the node application in the mono repo. Default `"."`. + +## Example usage + +```yaml +- uses: gogaille/setup-monorepo-node-app + with: + node-version: '14' + working-directory: 'some-node-app-dir' +``` diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..6731e34 --- /dev/null +++ b/action.yaml @@ -0,0 +1,32 @@ +name: Setup Monorepo node app +description: Prepare everything needed for a Nodejs app in a monorepo (cache, dependencies, ...) + +inputs: + node-version: + description: Nodejs version to use + required: true + default: '14' + working-directory: + description: Directory of the node application in the mono repo + required: true + +runs: + using: composite + steps: + - shell: bash + run: echo "🤙 Sparse checkout ${{inputs.working-directory}}" + - uses: gogaille/sparse-checkout@v0 + with: + patterns: ${{inputs.working-directory}} + - shell: bash + run: echo "⚙ Setup node version ${{inputs.node-version}}" + - uses: actions/setup-node@v2 + with: + node-version: ${{inputs.node-version}} + - shell: bash + run: echo "📦 Install dependencies" + - shell: bash + name: Install dependencies + run: | + cd ${{inputs.working-directory}} + yarn install --immutable --immutable-cache