Skip to content

build

build #94

Workflow file for this run

name: build
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
schedule:
- cron: '0 16 * * 0' # sunday 16:00
jobs:
build:
name: Node unit tests
runs-on: ubuntu-latest
strategy:
matrix:
node: ['14', '16', '17', '18', '19']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache .pnpm-store
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
uses: pnpm/action-setup@v2
with:
version: 7
run_install: true
- name: Install tests/public/www.sat.gob.mx
run: |
if [ -z "$(which wget)" ]; then
apt-get -q update
apt-get -q install wget
fi
cd tests/public
rm -r -f www.sat.gob.mx
wget -r -i sat-urls.txt
find -type f -name "*.x*" -exec sed -i 's#http://www.sat.gob.mx/sitio_internet#http://localhost:8999/www.sat.gob.mx/sitio_internet#g' "{}" \;
- name: Lint source
run: |
pnpm lint:check
- name: Build package
run: |
pnpm build
- name: Run tests
run: |
pnpm test:run
env:
CI: true
- name: 'Consume changesets'
if: github.event_name == 'push' && github.repository == 'nodecfdi/xml-resource-retriever' && matrix.node == 16 && github.ref == 'refs/heads/main'
uses: changesets/action@v1
id: 'changesets'
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
commit: 'chore: version bump'
title: Next release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 'Generate docs'
if: steps.changesets.outputs.published == 'true'
run: pnpm gen:docs
- name: Commit docs
if: steps.changesets.outputs.published == 'true'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'docs: generate docs'