Skip to content

Commit

Permalink
feat setup npm
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeNervoXS committed Nov 10, 2023
1 parent c1094eb commit 5906534
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/actions/setup-repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Setup repo
description: Runs all steps to setup the repo (install node_modules, build, etc...)
inputs:
registry-token:
description: 'PAT to access registries'
runs:
using: 'composite'
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
shell: bash
run: |
echo "::set-output name=dir::$(yarn cache dir)"
echo "::set-output name=version::$(yarn -v)"

- uses: actions/setup-node@v3
with:
node-version: '20'

- uses: actions/cache@v2
id: yarn-cache
with:
path: |
**/node_modules
${{ steps.yarn-cache-dir-path.outputs.dir }}

key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
shell: bash
run: echo "//npm.pkg.github.com/:_authToken=$GH_REGISTRY_ACCESS_TOKEN" >> .npmrc && yarn install --frozen-lockfile --verbose && rm -f .npmrc
env:
GH_REGISTRY_ACCESS_TOKEN: ${{ inputs.registry-token }}
5 changes: 5 additions & 0 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
node-version: 18
cache: "yarn"

- name: Setup repo
uses: ./.github/actions/setup-repo
with:
registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }}

- name: Install dependencies
run: yarn install

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
node-version: 18
cache: "yarn"

- name: Setup repo
uses: ./.github/actions/setup-repo
with:
registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }}

- name: Install dependencies
run: yarn install

Expand Down

0 comments on commit 5906534

Please sign in to comment.