Skip to content

Commit

Permalink
feat: add a seperate action to setup project
Browse files Browse the repository at this point in the history
  • Loading branch information
SudharakaP committed Dec 11, 2023
1 parent 670d2cd commit 8af11d6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
27 changes: 27 additions & 0 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Setup Project
description: Installs Node.js, NPM and dependencies and sets up the project

inputs:
DECRYPTION_SECRET:
description: The secret used to decrypt the files
required: true

runs:
using: 'composite'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
cache: 'npm'

- name: Install dependencies
shell: bash
run: npm ci --prefer-offline --no-audit --progress=false

- uses: amplium/git-crypt-action@master
with:
key_encoded: ${{ inputs.DECRYPTION_SECRET }}
18 changes: 7 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,22 @@ jobs:
timeout-minutes: 15

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: amplium/git-crypt-action@master
- name: Setup project
uses: ./.github/actions/setup-project
with:
key_encoded: ${{ secrets.DECRYPTION_SECRET }}
DECRYPTION_SECRET: ${{ secrets.DECRYPTION_SECRET }}

- run: npm run lint:quiet
- run: npm run eslint:quiet

prettier:
runs-on: ubuntu-latest

timeout-minutes: 15

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: amplium/git-crypt-action@master
- name: Setup project
uses: ./.github/actions/setup-project
with:
key_encoded: ${{ secrets.DECRYPTION_SECRET }}
DECRYPTION_SECRET: ${{ secrets.DECRYPTION_SECRET }}

- run: npm run prettier:check -
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"start-checker": "node check-for-changes.mjs",
"prettier:check": "prettier --check .",
"prettier:write": "prettier --write .",
"lint:quiet": "npm run lint -- --quiet",
"eslint:quiet": "npm run lint -- --quiet",
"eslint:fix": "eslint . --ignore-path .gitignore --ext .mjs,.js --fix"
}
}

0 comments on commit 8af11d6

Please sign in to comment.