build: update workflow + fix test #70
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: Test and Release | |
on: | |
push: | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- '.github/workflows/test.yaml' | |
- '.github/workflows/release.yaml' | |
pull_request: | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- '.github/workflows/test.yaml' | |
- '.github/workflows/release.yaml' | |
permissions: | |
contents: read | |
jobs: | |
integration-tests: | |
name: Run integration tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- run: npm ci | |
- name: Run tests | |
env: | |
AUTH1: ${{ secrets.AUTH1 }} | |
AUTH2: ${{ secrets.AUTH2 }} | |
MERCHANT_ID: ${{ secrets.MERCHANT_ID }} | |
AZUL_KEY: ${{ secrets.AZUL_KEY }} | |
AZUL_CERT: ${{ secrets.AZUL_CERT }} | |
run: npm run test | |
release: | |
name: Release | |
needs: integration-tests | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- name: Install dependencies | |
run: npm clean-install | |
- name: Verify the integrity of provenance attestations and registry signatures | |
run: npm audit signatures | |
- name: Build | |
run: npm run build | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx semantic-release |