-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (38 loc) · 1.19 KB
/
main.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
name: Run Tests on Version Change
on:
push:
paths:
- 'package.json'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Get Previous Version
id: get_previous_version
run: echo "::set-output name=previous_version::$(git show HEAD~1:package.json | jq -r .version)"
- name: Get Current Version
id: get_current_version
run: echo "::set-output name=current_version::$(jq -r .version package.json)"
- name: Compare Versions
id: compare_versions
run: |
if [ "${{ steps.get_previous_version.outputs.previous_version }}" != "${{ steps.get_current_version.outputs.current_version }}" ]; then
echo "Version changed!"
exit 0
else
echo "No version change detected."
exit 1
fi
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Install Dependencies
run: npm install
- name: Rodando postgres
run: docker-compose up postgres
- name: Run Tests
if: ${{ success() }}
run: npm test