CID-2097: Fix Snyk vulnerabilities #115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: action-dist-ci | |
concurrency: | |
group: action-dist-ci-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- 'dist/**' | |
workflow_dispatch: | |
jobs: | |
action-dist-ci: | |
name: Build and generate dist files | |
runs-on: ubuntu-latest | |
steps: | |
- name: Inject secret store credentials | |
uses: leanix/secrets-action@master | |
with: | |
secret-store-credentials: ${{ secrets.INJECTED_SECRET_STORE_CREDENTIALS }} | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
fetch-depth: 2 | |
token: ${{ env.GITHUB_TOKEN }} | |
- name: Read .node-version | |
id: nodejs | |
run: echo ::set-output name=version::$(cat .node-version) | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ steps.nodejs.outputs.version }} | |
- name: Install ncc to generate dist | |
run: npm i -g @vercel/ncc | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: ${{ runner.os }}-node- | |
- name: Install npm modules | |
run: npm ci | |
- name: Generate dist files | |
run: npm run build | |
- name: Commit & Push dist folder | |
run: | | |
if expr $(git status --porcelain | grep dist | wc -l) \> 0; then | |
git config user.name leanix-ci | |
git config user.email 'leanix-ci@users.noreply.github.com' | |
git add dist | |
git commit -m "Update dist files" | |
git push | |
else | |
echo "Nothing to commit" | |
fi |