-
Notifications
You must be signed in to change notification settings - Fork 3
74 lines (69 loc) · 2.23 KB
/
build.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
67
68
69
70
71
72
73
74
on:
push:
branches:
- main
pull_request:
branches:
- main
# from travis
# env:
# CHANGED_FILES: $(git diff --name-only $TRAVIS_COMMIT_RANGE)
jobs:
test:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-latest
node-version:
- 14.x
# outputs:
# all: ${{steps.changes.outputs.all}}
steps:
- name: 'Set up Node.js ${{ matrix.node-version }}'
uses: actions/setup-node@v1
with:
node-version: '${{ matrix.node-version }}'
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }}
restore-keys: v1-npm-deps-
# - name: Checkout repository get changed files
- name: Run build (test, validate)
uses: actions/checkout@v4
with:
fetch-depth: 0
env:
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
# CHANGED_FILES: $(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }})
run: |
echo "CHANGED_FILES=$(git diff --name-only $COMMIT_RANGE)" >> $GITHUB_ENV
echo $CHANGED_FILES
echo env
# run: 'npm ci'
# run: 'npm run bootstrap && npm run build:ci'
publish:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-latest
node-version:
- 14.x
# if: ${{ github.event_name != 'pull_request' }}
if: github.ref == 'refs/heads/main'
steps:
- name: Publish Package(s)
run: 'npm run publish'
# run: |
# echo "::set-output name=all::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)"
# from travis
# - run: >-
# if [[ $TRAVIS_PULL_REQUEST = "false" ]]; then PUBLISH_PACKAGE=true;
# else PUBLISH_PACKAGE=false; fi
# - run: >-
# echo "Pull Request: $TRAVIS_PULL_REQUEST" && echo "Node:
# $TRAVIS_NODE_VERSION" && echo "Publish? $PUBLISH_PACKAGE"
# - run: 'if [ $PUBLISH_PACKAGE = "true" ]; then npm run publish; fi'