npm CI #282
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: npm CI | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "0 0 * * 0" | |
jobs: | |
build-publish-linux: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.publish.outputs.page_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "16" | |
registry-url: "https://registry.npmjs.org" | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
- name: Cache the dependency directories | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
key: npm | |
- name: Save ccache | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
/tmp/ccache | |
key: cache-ccache-${{ matrix.target.id }} | |
- name: Install dependencies with npm | |
run: bun install | |
working-directory: ts | |
- name: Run tests with npm | |
run: bun test | |
working-directory: ts | |
- name: Build with bun | |
run: bun run build | |
working-directory: ts | |
- name: Publish to npm | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
package: ts/ | |
token: ${{ secrets.NPM_AUTH_TOKEN }} | |
access: "public" | |
- name: Setup GitHub Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload GitHub Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ts/typedoc | |
- name: Publish to GitHub pages | |
id: publish | |
uses: actions/deploy-pages@v4 |