chore: Update to deno v2 #345
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, Lint & Deploy' | |
on: [push, pull_request] | |
env: | |
DIRENV_WARN_TIMEOUT: 5m | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: Check Nix flake Nixpkgs inputs | |
uses: DeterminateSystems/flake-checker-action@main | |
- run: nix flake check --no-build | |
- name: Install direnv with Nix | |
uses: aldoborrero/direnv-nix-action@v2 | |
with: | |
use_nix_profile: true | |
- name: Lint | |
run: deno task lint | |
- name: Yaml lint | |
run: yamlfmt -lint . | |
- name: Format | |
run: deno task format | |
- name: Check types | |
run: deno task check | |
- name: Regenerate V2 | |
run: deno task generate-v2-client | |
- name: Diff porcelain | |
uses: mmontes11/[email protected] | |
with: | |
message: Generated OpenAPI client is not up to date. Run 'deno task generate-v2-client' and commit the changes. | |
- name: V2 Smoke Test | |
run: deno task test:single src/v2/tests/smoke_test.ts | |
- name: Test | |
run: deno task test:coverage | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-report | |
path: cov_profile/html/ | |
npm: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: Get tag version | |
if: startsWith(github.ref, 'refs/tags/') | |
id: get_tag_version | |
run: echo TAG_VERSION=${GITHUB_REF/refs\/tags\//} >> $GITHUB_OUTPUT | |
- name: Build | |
run: nix develop --command deno task build ${{steps.get_tag_version.outputs.TAG_VERSION}} | |
- name: Archive generated npm package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: npm-package | |
path: npm/ | |
- name: Publish to npm | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: nix develop --ignore-environment --keep NODE_AUTH_TOKEN --command bash -c 'pushd npm ; npm publish ; popd' | |
docs: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: Install direnv with Nix | |
uses: aldoborrero/direnv-nix-action@v2 | |
with: | |
use_nix_profile: true | |
- name: Generate docs | |
run: deno task docs | |
- name: Archive docs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: docs/ | |
- uses: actions/upload-pages-artifact@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
path: ./docs | |
docs-deploy: | |
permissions: | |
pages: write | |
id-token: write | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: docs | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |