diff --git a/.github/actions/setup-project/action.yml b/.github/actions/setup-project/action.yml new file mode 100644 index 0000000..027a76f --- /dev/null +++ b/.github/actions/setup-project/action.yml @@ -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 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 387f47a..fc6a04d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,14 +17,12 @@ 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 @@ -32,11 +30,9 @@ 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 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" } }