From 27b768cd8d39692e59f8f518b47b42e3f56c4cdc Mon Sep 17 00:00:00 2001 From: Sudharaka Date: Sun, 10 Dec 2023 23:14:09 -0800 Subject: [PATCH] feat: add a seperate action to setup project --- .github/actions/setup-project/action.yml | 24 ++++++++++++++++++++++++ .github/workflows/ci.yml | 12 +++++++----- package.json | 2 +- 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 .github/actions/setup-project/action.yml diff --git a/.github/actions/setup-project/action.yml b/.github/actions/setup-project/action.yml new file mode 100644 index 0000000..1c30f20 --- /dev/null +++ b/.github/actions/setup-project/action.yml @@ -0,0 +1,24 @@ +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: 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 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 387f47a..c74f65f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,11 +20,12 @@ jobs: - 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 @@ -35,8 +36,9 @@ jobs: - 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 - diff --git a/package.json b/package.json index 118e524..978a209 100644 --- a/package.json +++ b/package.json @@ -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" } }