Skip to content

Build client

Build client #92

name: Build client
on:
release:
types: [created]
jobs:
test_and_build:
name: Build and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun i
- name: Run tests
run: bun test
- name: Run Trivy scanner on fs
uses: aquasecurity/[email protected]
with:
scan-type: 'fs'
scan-ref: '.'
exit-code: 1
format: 'table'
ignore-unfixed: true
vuln-type: 'library'
severity: 'CRITICAL,HIGH'
- name: Run build
run: bun run build
env:
REF_NAME: ${{ github.ref_name }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: client-build-output
path: out
publish:
strategy:
fail-fast: false
matrix:
registry-url: ["https://npm.pkg.github.com", "https://registry.npmjs.org"]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
id-token: write
needs: [test_and_build]
steps:
- name: Download build output
uses: actions/download-artifact@v4
with:
name: client-build-output
path: .
- name: Set tag
id: tag
run: |
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
echo "tag=dev" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.release.prerelease }}" == "false" ]]; then
echo "tag=latest" >> $GITHUB_OUTPUT
fi
- name: Set registry token
id: token
run: |
if [[ "${{ matrix.registry-url }}" == "https://npm.pkg.github.com" ]]; then
echo "token=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_OUTPUT
fi
if [[ "${{ matrix.registry-url }}" == "https://registry.npmjs.org" ]]; then
echo "token=${{ secrets.NPM_TOKEN }}" >> $GITHUB_OUTPUT
fi
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ steps.token.outputs.token }}
registry: ${{ matrix.registry-url }}
tag: ${{ steps.tag.outputs.tag }}