|
| 1 | +name: Website |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - 'packages/website/**' |
| 8 | + - '.github/**' |
| 9 | + - 'package.json' |
| 10 | + - 'yarn.lock' |
| 11 | + push: |
| 12 | + branches: [main] |
| 13 | + paths: |
| 14 | + - 'packages/website/**' |
| 15 | + - '.github/**' |
| 16 | + - 'package.json' |
| 17 | + - 'yarn.lock' |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + - uses: volta-cli/action@v1 |
| 24 | + - name: restore lerna |
| 25 | + uses: actions/cache@v2 |
| 26 | + with: |
| 27 | + path: | |
| 28 | + node_modules |
| 29 | + */*/node_modules |
| 30 | + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} |
| 31 | + - run: | |
| 32 | + yarn |
| 33 | + yarn lerna bootstrap |
| 34 | + - name: Build |
| 35 | + run: yarn lerna run build --scope website |
| 36 | + - name: Lint |
| 37 | + run: yarn lerna run lint --scope website |
| 38 | + - name: Test |
| 39 | + run: yarn lerna run test --scope website |
| 40 | + |
| 41 | + os-compatibility: |
| 42 | + needs: build |
| 43 | + runs-on: ${{ matrix.os }} |
| 44 | + strategy: |
| 45 | + matrix: |
| 46 | + os: |
| 47 | + # - macos-latest |
| 48 | + - windows-latest |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v2 |
| 51 | + - uses: volta-cli/action@v1 |
| 52 | + - name: restore lerna |
| 53 | + uses: actions/cache@v2 |
| 54 | + with: |
| 55 | + path: | |
| 56 | + node_modules |
| 57 | + */*/node_modules |
| 58 | + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} |
| 59 | + - run: | |
| 60 | + yarn |
| 61 | + yarn lerna bootstrap |
| 62 | + - name: Build |
| 63 | + run: yarn lerna run build --scope website |
| 64 | + - name: Test |
| 65 | + run: yarn lerna run test --scope website |
| 66 | + |
| 67 | + node-compatibility: |
| 68 | + needs: build |
| 69 | + runs-on: ubuntu-latest |
| 70 | + |
| 71 | + strategy: |
| 72 | + matrix: |
| 73 | + node-version: [14.x, 16.x] |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v2 |
| 76 | + - uses: volta-cli/action@v1 |
| 77 | + with: |
| 78 | + node-version: ${{ matrix.node-version }} |
| 79 | + - name: restore lerna |
| 80 | + uses: actions/cache@v2 |
| 81 | + with: |
| 82 | + path: | |
| 83 | + node_modules |
| 84 | + */*/node_modules |
| 85 | + key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} |
| 86 | + - run: | |
| 87 | + yarn |
| 88 | + yarn lerna bootstrap |
| 89 | + - name: Build |
| 90 | + run: yarn lerna run build --scope website |
| 91 | + - name: Test |
| 92 | + run: yarn lerna run test --scope website |
| 93 | + |
| 94 | + |
| 95 | + ts-compatibility: |
| 96 | + needs: build |
| 97 | + runs-on: ubuntu-latest |
| 98 | + continue-on-error: ${{ matrix.experimental }} |
| 99 | + strategy: |
| 100 | + matrix: |
| 101 | + typescript-version: ['~4.2.0', '~4.3.0', '~4.4.0','~4.5.0', latest, next, beta, rc] |
| 102 | + include: |
| 103 | + - typescript-version: '~4.2.0' |
| 104 | + experimental: false |
| 105 | + name: 'ts-4.2' |
| 106 | + - typescript-version: '~4.3.0' |
| 107 | + experimental: false |
| 108 | + name: 'ts-4.3' |
| 109 | + - typescript-version: '~4.4.0' |
| 110 | + experimental: false |
| 111 | + name: 'ts-4.4' |
| 112 | + - typescript-version: '~4.5.0' |
| 113 | + experimental: false |
| 114 | + name: 'ts-4.5' |
| 115 | + - typescript-version: latest |
| 116 | + experimental: false |
| 117 | + name: 'ts-stable' |
| 118 | + - typescript-version: beta |
| 119 | + experimental: false |
| 120 | + name: 'ts-beta' |
| 121 | + - typescript-version: rc |
| 122 | + experimental: true |
| 123 | + name: 'ts-rc' |
| 124 | + - typescript-version: next |
| 125 | + experimental: true |
| 126 | + name: 'ts-canary' |
| 127 | + |
| 128 | + |
| 129 | + steps: |
| 130 | + - uses: actions/checkout@v2 |
| 131 | + - uses: volta-cli/action@v1 |
| 132 | + - name: restore lerna |
| 133 | + uses: actions/cache@v2 |
| 134 | + with: |
| 135 | + path: | |
| 136 | + node_modules |
| 137 | + */*/node_modules |
| 138 | + key: ${{ runner.os }}-${{ matrix.typescript-version }}-${{ hashFiles('**/yarn.lock') }} |
| 139 | + - run: | |
| 140 | + yarn |
| 141 | + yarn lerna bootstrap |
| 142 | + - name: Installing TypeScript ${{ matrix.typescript-version }} |
| 143 | + run: | |
| 144 | + yarn lerna add -D typescript@${{ matrix.typescript-version}} |
| 145 | + - name: Build |
| 146 | + run: yarn lerna run build --scope website |
| 147 | + - name: TypeScript compile |
| 148 | + run: | |
| 149 | + yarn replace-in-file 'import chalk' 'import * as chalk' node_modules/gatsby-cli/lib/reporter/reporter.d.ts |
| 150 | + yarn lerna run typecheck --scope website |
| 151 | + - name: Test |
| 152 | + run: yarn lerna run test --scope website |
| 153 | + |
| 154 | + publish: |
| 155 | + needs: [build, os-compatibility, node-compatibility, ts-compatibility] |
| 156 | + runs-on: ubuntu-latest |
| 157 | + if: success() && github.ref == 'refs/heads/main' |
| 158 | + steps: |
| 159 | + - uses: actions/checkout@v1 |
| 160 | + - uses: volta-cli/action@v1 |
| 161 | + - run: | |
| 162 | + yarn |
| 163 | + yarn lerna bootstrap |
| 164 | + - name: Build |
| 165 | + run: yarn lerna run build-prod --scope website |
| 166 | + - uses: peaceiris/actions-gh-pages@v3 |
| 167 | + with: |
| 168 | + github_token: ${{ secrets.ACCESS_TOKEN }} |
| 169 | + publish_dir: ./packages/website/public |
| 170 | + cname: www.typescript-training.com |
| 171 | + |
0 commit comments