Skip to content

Merge branch 'main' of github.com:710lucas/Briefing-back #3

Merge branch 'main' of github.com:710lucas/Briefing-back

Merge branch 'main' of github.com:710lucas/Briefing-back #3

Workflow file for this run

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