Skip to content

๐Ÿ—๏ธ build #98

๐Ÿ—๏ธ build

๐Ÿ—๏ธ build #98

name: Build client
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
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 linter
run: bunx biome ci
- name: Run typecheck
run: bun run typecheck
- 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
package.json
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 }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag'
with:
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}