-
Notifications
You must be signed in to change notification settings - Fork 3
66 lines (55 loc) · 1.71 KB
/
action-dist-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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