|
| 1 | +name: Run CI |
| 2 | + |
| 3 | +# Run this workflow every time a new commit pushed to your repository |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - maykin-4.13.12 |
| 8 | + tags: |
| 9 | + - '*' |
| 10 | + pull_request: |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: Create 'production' build |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + - uses: actions/setup-node@v3 |
| 21 | + with: |
| 22 | + node-version-file: '.nvmrc' |
| 23 | + cache: npm |
| 24 | + |
| 25 | + - name: Build |
| 26 | + run: | |
| 27 | + npm install |
| 28 | + npm run build |
| 29 | +
|
| 30 | + unit-tests: |
| 31 | + name: Run unit tests |
| 32 | + runs-on: ubuntu-latest |
| 33 | + needs: build |
| 34 | + |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v3 |
| 37 | + - uses: actions/setup-node@v3 |
| 38 | + with: |
| 39 | + node-version-file: '.nvmrc' |
| 40 | + cache: npm |
| 41 | + |
| 42 | + - name: Install dependencies |
| 43 | + run: npm install --include=dev |
| 44 | + |
| 45 | + - name: Run unit tests |
| 46 | + run: | |
| 47 | + npm run test |
| 48 | +
|
| 49 | +# In their circleci workflow, they don't run these. |
| 50 | +# renderer-tests: |
| 51 | +# name: Run renderer tests |
| 52 | +# runs-on: ubuntu-latest |
| 53 | +# needs: build |
| 54 | +# |
| 55 | +# steps: |
| 56 | +# - uses: actions/checkout@v3 |
| 57 | +# - uses: actions/setup-node@v3 |
| 58 | +# with: |
| 59 | +# node-version-file: '.nvmrc' |
| 60 | +# cache: npm |
| 61 | +# |
| 62 | +# - name: Install dependencies |
| 63 | +# run: | |
| 64 | +# - npm install --include=dev |
| 65 | +# - npm run build |
| 66 | +# |
| 67 | +# - name: Run renderer tests |
| 68 | +# run: | |
| 69 | +# npm run test:updateRenders |
| 70 | +# |
| 71 | +# e2e-tests: |
| 72 | +# name: Run E2E tests |
| 73 | +# runs-on: ubuntu-latest |
| 74 | +# needs: build |
| 75 | +# |
| 76 | +# steps: |
| 77 | +# - uses: actions/checkout@v3 |
| 78 | +# - uses: actions/setup-node@v3 |
| 79 | +# with: |
| 80 | +# node-version-file: '.nvmrc' |
| 81 | +# cache: npm |
| 82 | +# |
| 83 | +# - name: Install dependencies |
| 84 | +# run: | |
| 85 | +# - npm install --include=dev |
| 86 | +# - npm run build |
| 87 | +# |
| 88 | +# - name: Run E2E tests |
| 89 | +# run: | |
| 90 | +# npm run test:e2e |
| 91 | + |
| 92 | + publish: |
| 93 | + name: Publish the NPM package |
| 94 | + runs-on: ubuntu-latest |
| 95 | + needs: |
| 96 | + - build |
| 97 | + - unit-tests |
| 98 | + - renderer-tests |
| 99 | + - e2e-tests |
| 100 | + |
| 101 | + # do not publish in forks or non-tag pushes |
| 102 | + if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'open-formulieren' |
| 103 | + |
| 104 | + steps: |
| 105 | + - uses: actions/checkout@v3 |
| 106 | + - uses: actions/setup-node@v3 |
| 107 | + with: |
| 108 | + node-version-file: '.nvmrc' |
| 109 | + cache: npm |
| 110 | + registry-url: 'https://registry.npmjs.org' |
| 111 | + scope: '@open-formulieren' |
| 112 | + |
| 113 | + - name: Build |
| 114 | + run: | |
| 115 | + - npm install |
| 116 | + - npm run build |
| 117 | +
|
| 118 | + - name: Publish package to NPM |
| 119 | + run: | |
| 120 | + - run: npm publish |
| 121 | + env: |
| 122 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 123 | + |
0 commit comments