Activate isolatedModules #1108
Workflow file for this run
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: main | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Need all tags to get a version number in-between tags | |
- uses: actions/setup-node@v4 | |
with: | |
cache: 'yarn' | |
- run: yarn --frozen-lockfile | |
- run: yarn build-demo | |
- run: yarn build-natural # Build natural again, because when building natural-editor ngcc was used on natural | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: 'yarn' | |
- run: yarn --frozen-lockfile | |
- run: ./node_modules/.bin/ng test natural --progress false --watch=false --browsers ChromeHeadlessCustom | |
- run: ./node_modules/.bin/ng test natural-editor --progress false --watch=false --browsers ChromeHeadlessCustom | |
- run: ./node_modules/.bin/ng test demo --progress false --watch=false --browsers ChromeHeadlessCustom | |
# - run: yarn e2e | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: 'yarn' | |
- run: yarn --frozen-lockfile | |
- run: yarn lint | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: 'yarn' | |
- run: yarn --frozen-lockfile | |
- run: ./node_modules/.bin/prettier --check . | |
publish-demo: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- test | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- uses: crazy-max/ghaction-github-pages@v4 | |
with: | |
build_dir: dist/demo/browser | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
packages: write | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
needs: | |
- build | |
- test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} # Otherwise our annotated tag is not fetched and we cannot get correct version | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- run: rm .gitignore | |
# Publish to npm | |
- uses: actions/setup-node@v4 | |
with: | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm publish --provenance --access public dist/natural/ | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- run: npm publish --provenance --access public dist/natural-editor/ | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# Publish to GitHub Packages | |
- uses: actions/setup-node@v4 | |
with: | |
registry-url: 'https://npm.pkg.github.com' | |
- run: npm publish --provenance --access public dist/natural/ | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: npm publish --provenance --access public dist/natural-editor/ | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Create release | |
- name: Get release info | |
run: git tag --format '%(contents:body)' --points-at > release-body.txt | |
- uses: ncipollo/release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
bodyFile: release-body.txt |