Web build update and schema name changes #91
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: Build, Test, and Publish | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
release-please: | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
version: ${{ steps.release.outputs.version }} | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
release-type: node | |
default-branch: main | |
package-name: psychds-validator | |
path: . | |
token: ${{ secrets.GITHUB_TOKEN }} | |
build-test-publish: | |
needs: [release-please] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- name: Cache Dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.deno | |
key: ${{ runner.OS }}-deno-${{ hashFiles('**/deno.json', 'src/deps/*.ts') }} | |
- name: Cache Dependencies 2 | |
run: deno cache --allow-scripts=npm:[email protected] src/index.ts | |
- name: Run Deno Tests | |
run: deno test --allow-all | |
- name: Run Type Check | |
run: deno check **/*.ts | |
- name: Install dependencies | |
run: npm install jsonld @types/jsonld | |
- name: Get version from package.json | |
id: get_version | |
run: | | |
VERSION=$(node -p "require('./package.json').version") | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
- name: Build NPM Package | |
run: deno run --allow-read --allow-write --allow-env --allow-net --allow-run --allow-sys --allow-ffi --allow-hrtime -A build_npm.ts ${{ steps.get_version.outputs.VERSION }} | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install Dependencies | |
run: npm ci | |
working-directory: npm | |
- name: Run NPM Tests | |
run: npm test | |
working-directory: npm | |
- name: Publish to NPM | |
if: needs.release-please.outputs.release_created == 'true' | |
run: npm publish | |
working-directory: npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |