From 0158fb6d335ed76c653fb9797be9d41bc52b1be4 Mon Sep 17 00:00:00 2001 From: Romain Lenzotti Date: Fri, 25 Oct 2024 19:17:38 +0200 Subject: [PATCH] ci: update website deployment job --- .github/workflows/build.yml | 76 ++++++++++++++++++----------------- .github/workflows/website.yml | 39 +++--------------- package.json | 21 ++++++++++ 3 files changed, 65 insertions(+), 71 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fbc8fbdb73e..832d4e619c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ on: push: branches: [production, alpha, beta, rc] pull_request: - branches: [production] + branches: [production, alpha, beta, rc] types: [opened, synchronize, closed] concurrency: @@ -22,9 +22,9 @@ jobs: node-version: [20.12.2] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Install dependencies @@ -40,13 +40,14 @@ jobs: node-version: [20.12.2] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "yarn" - name: Install dependencies run: yarn install --immutable --network-timeout 500000 - name: Run build @@ -60,7 +61,7 @@ jobs: - name: Upload vitest config files uses: actions/upload-artifact@v4 with: - name: vitest-config-integration-${{ matrix.os }}-${{ matrix.version }} + name: vitest-config-integration overwrite: true path: | team.json @@ -74,25 +75,17 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - node-version: [20.12.2, 22.x] - exclude: - - os: macos-latest - node-version: 20.x - - os: macos-latest - node-version: 20.12.2 - - os: windows-latest - node-version: 20.x - - os: windows-latest - node-version: 20.12.2 + node-version: [20.12.2] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "yarn" - name: Install dependencies run: yarn install --immutable --network-timeout 500000 - name: Run build @@ -112,13 +105,14 @@ jobs: node-version: [20.12.2] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "yarn" - name: Install dependencies run: yarn install --immutable --network-timeout 500000 - name: Run build @@ -144,13 +138,14 @@ jobs: node-version: [20.12.2] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "yarn" - name: Install dependencies run: yarn install --immutable --network-timeout 500000 - name: Run build @@ -173,13 +168,14 @@ jobs: node-version: [20.12.2] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "yarn" - name: Install dependencies run: yarn install --immutable --network-timeout 500000 - name: Run build @@ -203,13 +199,14 @@ jobs: node-version: [20.12.2] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "yarn" - name: Install dependencies run: yarn install --immutable --network-timeout 500000 - name: Run build @@ -231,13 +228,14 @@ jobs: node-version: [20.12.2] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "yarn" - name: Install dependencies run: yarn install --immutable --network-timeout 500000 - name: Run build @@ -259,13 +257,14 @@ jobs: node-version: [20.12.2] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "yarn" - name: Install dependencies run: yarn install --immutable --network-timeout 500000 - name: Run build @@ -287,13 +286,14 @@ jobs: node-version: [20.12.2] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "yarn" - name: Install dependencies run: yarn install --immutable --network-timeout 500000 - name: Run build @@ -317,11 +317,12 @@ jobs: matrix: node-version: [20.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "yarn" - name: Download Core vitest config files uses: actions/download-artifact@v4 with: @@ -349,11 +350,12 @@ jobs: node-version: [20.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "yarn" - name: Install dependencies run: yarn install --network-timeout 500000 @@ -376,4 +378,4 @@ jobs: curl -X POST https://api.github.com/repos/tsedio/tsed/actions/workflows/website.yml/dispatches \ -H 'Accept: application/vnd.github.everest-preview+json' \ -H 'Authorization: Bearer ${{secrets.GH_TOKEN}}' \ - --data '{"ref": "production"}' + --data '{"ref": "${{github.ref_name}}"}' diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index d3d97b1fb60..5ff031d5d68 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -1,6 +1,3 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - name: Website on: @@ -14,44 +11,18 @@ permissions: jobs: publish-docs: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [20.x] - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Install dependencies - run: yarn install --immutable --network-timeout 500000 - - name: Build pages - env: - CI: true - run: yarn api:build && yarn vuepress:docs:build - - name: Publish pages - env: - CI: true - GH_TOKEN: ${{ secrets.GH_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: yarn docs:publish - publish-refs: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [20.x] steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20.x - name: Install dependencies run: yarn install --immutable --network-timeout 500000 - name: Build pages env: CI: true - run: yarn api:build && yarn vuepress:ref:build + run: yarn api:build && yarn vitepress:docs:build - name: Publish pages env: CI: true diff --git a/package.json b/package.json index 8b42ca053df..52f1a567e5a 100644 --- a/package.json +++ b/package.json @@ -204,6 +204,27 @@ "branch": "main", "cname": "api-docs.tsed.io", "if": "production" + }, + { + "dir": "./docs/.vuepress/dist", + "url": "https://github.com/tsedio/rc.tsed.dev.git", + "branch": "gh-pages", + "cname": "rc.tsed.dev", + "if": "rc" + }, + { + "dir": "./docs/.vitepress/dist", + "url": "https://github.com/tsedio/beta.tsed.dev.git", + "branch": "main", + "cname": "beta.tsed.dev", + "if": "beta" + }, + { + "dir": "./docs/.vitepress/dist", + "url": "https://github.com/tsedio/alpha.tsed.dev.git", + "branch": "main", + "cname": "alpha.tsed.dev", + "if": "alpha" } ] },