|
| 1 | +name: Main |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + install: |
| 14 | + if: "!contains(github.event.head_commit.message, 'skip ci')" |
| 15 | + name: Install |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + os: [ubuntu-latest] |
| 21 | + node: [20] |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/setup-node@v4 |
| 25 | + with: |
| 26 | + node-version: ${{ matrix.node }} |
| 27 | + - name: Checkout Repo |
| 28 | + uses: actions/checkout@v4 |
| 29 | + - name: cache node_modules |
| 30 | + uses: actions/cache@v4 |
| 31 | + id: cache |
| 32 | + with: |
| 33 | + path: | |
| 34 | + node_modules |
| 35 | + key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} |
| 36 | + |
| 37 | + - name: Install Dependencies |
| 38 | + if: steps.cache.outputs.cache-hit != 'true' |
| 39 | + run: npm ci |
| 40 | + |
| 41 | + - name: Lint |
| 42 | + run: npm run lint |
| 43 | + |
| 44 | + - name: Test |
| 45 | + run: npm run test |
| 46 | + |
| 47 | + semantic-version: |
| 48 | + name: Semantic Release |
| 49 | + needs: install |
| 50 | + runs-on: ${{ matrix.os }} |
| 51 | + |
| 52 | + strategy: |
| 53 | + matrix: |
| 54 | + os: [ubuntu-latest] |
| 55 | + node: [20] |
| 56 | + |
| 57 | + steps: |
| 58 | + - uses: actions/setup-node@v4 |
| 59 | + with: |
| 60 | + node-version: ${{ matrix.node }} |
| 61 | + - name: Checkout Repo |
| 62 | + uses: actions/checkout@v4 |
| 63 | + - name: cache node_modules |
| 64 | + uses: actions/cache@v4 |
| 65 | + id: cache |
| 66 | + with: |
| 67 | + path: node_modules |
| 68 | + key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} |
| 69 | + - name: Versioning |
| 70 | + env: |
| 71 | + HUSKY: 0 |
| 72 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 74 | + run: | |
| 75 | + npx -p semantic-release -p @semantic-release/git -p @semantic-release/changelog -p @semantic-release/exec -p @semantic-release/github semantic-release --provider=github |
| 76 | +
|
| 77 | + build-playground: |
| 78 | + name: Build (Playground) |
| 79 | + needs: semantic-version |
| 80 | + runs-on: ${{ matrix.os }} |
| 81 | + |
| 82 | + strategy: |
| 83 | + matrix: |
| 84 | + os: [ubuntu-latest] |
| 85 | + node: [20] |
| 86 | + |
| 87 | + steps: |
| 88 | + - uses: actions/setup-node@v4 |
| 89 | + with: |
| 90 | + node-version: ${{ matrix.node }} |
| 91 | + - name: Checkout Repo |
| 92 | + uses: actions/checkout@v4 |
| 93 | + - name: cache node_modules |
| 94 | + uses: actions/cache@v4 |
| 95 | + id: cache |
| 96 | + with: |
| 97 | + path: node_modules |
| 98 | + key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} |
| 99 | + - name: Build |
| 100 | + run: | |
| 101 | + npm run build |
| 102 | + touch playground/dist/.nojekyll |
| 103 | + env: |
| 104 | + BASE_URL: /vue-semantic-structure/playground/ |
| 105 | + VITE_GITHUB_URL: https://github.com/basics/vue-semantic-structure |
| 106 | + - name: Archive Production Artifact |
| 107 | + uses: actions/upload-artifact@v4 |
| 108 | + with: |
| 109 | + name: playgroundArtifact |
| 110 | + path: playground/dist |
| 111 | + |
| 112 | + build-docs: |
| 113 | + name: Build (Docs) |
| 114 | + needs: semantic-version |
| 115 | + runs-on: ${{ matrix.os }} |
| 116 | + |
| 117 | + strategy: |
| 118 | + matrix: |
| 119 | + os: [ubuntu-latest] |
| 120 | + node: [20] |
| 121 | + |
| 122 | + steps: |
| 123 | + - uses: actions/setup-node@v4 |
| 124 | + with: |
| 125 | + node-version: ${{ matrix.node }} |
| 126 | + - name: Checkout Repo |
| 127 | + uses: actions/checkout@v4 |
| 128 | + - name: cache docs/node_modules |
| 129 | + uses: actions/cache@v4 |
| 130 | + id: cache |
| 131 | + with: |
| 132 | + path: | |
| 133 | + node_modules |
| 134 | + key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} |
| 135 | + - name: Build |
| 136 | + run: | |
| 137 | + npm run docs:build |
| 138 | + touch docs/.vitepress/dist/.nojekyll |
| 139 | + env: |
| 140 | + BASE_URL: /vue-semantic-structure/ |
| 141 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 142 | + - name: Archive Production Artifact |
| 143 | + uses: actions/upload-artifact@v4 |
| 144 | + with: |
| 145 | + name: docsArtifact |
| 146 | + path: docs/.vitepress/dist |
| 147 | + |
| 148 | + deploy-ghpages: |
| 149 | + name: Deploy (GH-Pages) |
| 150 | + needs: [build-docs, build-playground] |
| 151 | + runs-on: ${{ matrix.os }} |
| 152 | + strategy: |
| 153 | + matrix: |
| 154 | + os: [ubuntu-latest] |
| 155 | + node: [20] |
| 156 | + steps: |
| 157 | + - name: Download Artifact (Docs) |
| 158 | + uses: actions/download-artifact@v4 |
| 159 | + with: |
| 160 | + name: docsArtifact |
| 161 | + path: public |
| 162 | + - name: Download Artifact (Playground) |
| 163 | + uses: actions/download-artifact@v4 |
| 164 | + with: |
| 165 | + name: playgroundArtifact |
| 166 | + path: public/playground |
| 167 | + - name: Deploy to GH-Pages |
| 168 | + uses: peaceiris/actions-gh-pages@v4 |
| 169 | + with: |
| 170 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 171 | + publish_dir: public |
0 commit comments