|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + name: Build |
| 10 | + runs-on: ubuntu-latest |
| 11 | + defaults: |
| 12 | + run: |
| 13 | + shell: bash |
| 14 | + steps: |
| 15 | + - name: 'Checkout' |
| 16 | + uses: actions/checkout@v3 |
| 17 | + - name: Read Node.js version from package.json |
| 18 | + run: echo "nodeVersion=$(node -p "require('./package.json').engines.node")" >> $GITHUB_OUTPUT |
| 19 | + id: engines |
| 20 | + - name: 'Setup Node' |
| 21 | + uses: actions/setup-node@v3 |
| 22 | + with: |
| 23 | + node-version: ${{ steps.engines.outputs.nodeVersion }} |
| 24 | + - run: | |
| 25 | + yarn install --immutable |
| 26 | + - run: yarn build |
| 27 | + build-storybook: |
| 28 | + name: Build Storybook |
| 29 | + runs-on: ubuntu-latest |
| 30 | + defaults: |
| 31 | + run: |
| 32 | + shell: bash |
| 33 | + steps: |
| 34 | + - name: 'Checkout' |
| 35 | + uses: actions/checkout@v3 |
| 36 | + - name: Read Node.js version from package.json |
| 37 | + run: echo "nodeVersion=$(node -p "require('./package.json').engines.node")" >> $GITHUB_OUTPUT |
| 38 | + id: engines |
| 39 | + - name: 'Setup Node' |
| 40 | + uses: actions/setup-node@v3 |
| 41 | + with: |
| 42 | + node-version: ${{ steps.engines.outputs.nodeVersion }} |
| 43 | + - run: yarn install --immutable |
| 44 | + - run: yarn build:storybook |
| 45 | + test: |
| 46 | + name: Unit test |
| 47 | + runs-on: ubuntu-latest |
| 48 | + defaults: |
| 49 | + run: |
| 50 | + shell: bash |
| 51 | + steps: |
| 52 | + - name: 'Checkout' |
| 53 | + uses: actions/checkout@v3 |
| 54 | + - name: Read Node.js version from package.json |
| 55 | + run: echo "nodeVersion=$(node -p "require('./package.json').engines.node")" >> $GITHUB_OUTPUT |
| 56 | + id: engines |
| 57 | + - name: 'Setup Node' |
| 58 | + uses: actions/setup-node@v3 |
| 59 | + with: |
| 60 | + node-version: ${{ steps.engines.outputs.nodeVersion }} |
| 61 | + - run: | |
| 62 | + yarn install --immutable |
| 63 | + - run: yarn test |
| 64 | + lint: |
| 65 | + name: Lint |
| 66 | + runs-on: ubuntu-latest |
| 67 | + defaults: |
| 68 | + run: |
| 69 | + shell: bash |
| 70 | + steps: |
| 71 | + - name: 'Checkout' |
| 72 | + uses: actions/checkout@v3 |
| 73 | + - name: Read Node.js version from package.json |
| 74 | + run: echo "nodeVersion=$(node -p "require('./package.json').engines.node")" >> $GITHUB_OUTPUT |
| 75 | + id: engines |
| 76 | + - name: 'Setup Node' |
| 77 | + uses: actions/setup-node@v3 |
| 78 | + with: |
| 79 | + node-version: ${{ steps.engines.outputs.nodeVersion }} |
| 80 | + - run: | |
| 81 | + yarn install --immutable |
| 82 | + - run: yarn lint |
| 83 | + preview: |
| 84 | + name: Create preview |
| 85 | + if: ${{ github.triggering_actor != 'plural-renovate[bot]' }} |
| 86 | + runs-on: ubuntu-latest |
| 87 | + steps: |
| 88 | + - name: 'Checkout' |
| 89 | + uses: actions/checkout@v3 |
| 90 | + - name: Read Node.js version from package.json |
| 91 | + run: echo "nodeVersion=$(node -p "require('./package.json').engines.node")" >> $GITHUB_OUTPUT |
| 92 | + id: engines |
| 93 | + - name: 'Setup Node' |
| 94 | + uses: actions/setup-node@v3 |
| 95 | + with: |
| 96 | + node-version: ${{ steps.engines.outputs.nodeVersion }} |
| 97 | + - run: | |
| 98 | + yarn install --immutable |
| 99 | + - run: yarn build:storybook |
| 100 | + - uses: FirebaseExtended/action-hosting-deploy@v0 |
| 101 | + with: |
| 102 | + repoToken: '${{ secrets.GITHUB_TOKEN }}' |
| 103 | + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PLURALSH_DESIGN }}' |
| 104 | + projectId: pluralsh-design |
| 105 | + trivy-scan: |
| 106 | + name: Trivy fs scan |
| 107 | + runs-on: ubuntu-latest |
| 108 | + permissions: |
| 109 | + contents: read # for actions/checkout to fetch code |
| 110 | + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results |
| 111 | + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status |
| 112 | + steps: |
| 113 | + - name: Checkout code |
| 114 | + uses: actions/checkout@v3 |
| 115 | + - name: Run Trivy vulnerability scanner in fs mode |
| 116 | + uses: aquasecurity/trivy-action@master |
| 117 | + with: |
| 118 | + scan-type: 'fs' |
| 119 | + hide-progress: false |
| 120 | + format: 'sarif' |
| 121 | + output: 'trivy-results.sarif' |
| 122 | + security-checks: 'vuln,secret' |
| 123 | + ignore-unfixed: true |
| 124 | + #severity: 'CRITICAL,HIGH' |
| 125 | + - name: Upload Trivy scan results to GitHub Security tab |
| 126 | + uses: github/codeql-action/upload-sarif@v2 |
| 127 | + with: |
| 128 | + sarif_file: 'trivy-results.sarif' |
0 commit comments