|
| 1 | +name: Node.js CI |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + test: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + node: [14.21.3] |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v3 |
| 13 | + - uses: actions/setup-node@v3 |
| 14 | + with: |
| 15 | + node-version: ${{ matrix.node }} |
| 16 | + cache: 'npm' |
| 17 | + - uses: webfactory/ssh-agent@v0.7.0 |
| 18 | + with: |
| 19 | + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 20 | + - name: Add Know Hosts |
| 21 | + run: | |
| 22 | + ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts |
| 23 | + shell: bash |
| 24 | + - name: Install dependencies and regenerate package-lock.json |
| 25 | + run: npm install |
| 26 | + - name: Clean install on CI |
| 27 | + run: npm ci |
| 28 | + - name: Linter code check |
| 29 | + run: npm run lint:check |
| 30 | + - name: Testing JEST |
| 31 | + run: npm run test |
| 32 | + release: |
| 33 | + if: github.ref == 'refs/heads/main' |
| 34 | + needs: test |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v3 |
| 38 | + - uses: actions/setup-node@v3 |
| 39 | + with: |
| 40 | + node-version: 14.21.3 |
| 41 | + cache: 'npm' |
| 42 | + - uses: webfactory/ssh-agent@v0.7.0 |
| 43 | + with: |
| 44 | + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 45 | + - name: Add Know Hosts |
| 46 | + run: | |
| 47 | + ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts |
| 48 | + shell: bash |
| 49 | + - name: Clean install on CI |
| 50 | + run: npm ci |
| 51 | + - name: Build library |
| 52 | + run: npm run build |
| 53 | + - name: Release version |
| 54 | + run: npx semantic-release@18 |
| 55 | + env: |
| 56 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 58 | + pages: |
| 59 | + if: github.ref == 'refs/heads/main' |
| 60 | + needs: release |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v3 |
| 64 | + - uses: actions/setup-node@v3 |
| 65 | + with: |
| 66 | + node-version: 14.21.3 |
| 67 | + cache: 'npm' |
| 68 | + - uses: webfactory/ssh-agent@v0.7.0 |
| 69 | + with: |
| 70 | + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 71 | + - name: Add Know Hosts |
| 72 | + run: | |
| 73 | + ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts |
| 74 | + shell: bash |
| 75 | + - name: Clean install on CI |
| 76 | + run: npm ci |
| 77 | + - name: Deploy to GH Pages |
| 78 | + env: |
| 79 | + GH_TOKEN: eclass:${{ secrets.GITHUB_TOKEN }} |
| 80 | + run: npm run deploy-storybook -- --source-branch=main |
| 81 | + |
0 commit comments