Merge pull request #23 from Program-AR/dependabot/npm_and_yarn/multi-… #197
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: run-tests | |
on: | |
push: # runs on every push to this repo | |
pull_request: # and for outside collaborations | |
release: | |
types: | |
- released | |
jobs: | |
test: # condition below avoids double runs for local pull requests: | |
if: ${{ github.event_name == 'push' || !startsWith(github.event.pull_request.head.repo.full_name, github.repository_owner) }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- uses: supercharge/mongodb-github-action@1.6.0 | |
#https://docs.github.com/es/actions/guides/caching-dependencies-to-speed-up-workflows#using-the-cache-action | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- run: npm install | |
- name: Run tests | |
run: npm run test | |
package-on-tag: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
#https://docs.github.com/es/actions/guides/caching-dependencies-to-speed-up-workflows#using-the-cache-action | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- run: npm install | |
- name: Package | |
run: npm run package | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
pilasbloques-api.tar.gz | |
pilasbloques-analytics.tar.gz |