From d2b00ccf2ab0ec793f3c3bf2e0c6baff8f3a96a4 Mon Sep 17 00:00:00 2001 From: relliv Date: Mon, 4 Nov 2024 14:50:48 +0300 Subject: [PATCH] Update ci/cd flow --- .github/workflows/ci.yml | 45 ------------- .github/workflows/deploy-to-github-pages.yml | 66 ++++++++++++++++++++ 2 files changed, 66 insertions(+), 45 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/deploy-to-github-pages.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 3cba693..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: CI - -on: - push: - branches: - - master - pull_request: - -permissions: - actions: read - contents: read - -jobs: - main: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: pnpm/action-setup@v4 - with: - version: 9 - - - - # This enables task distribution via Nx Cloud - # Run this command as early as possible, before dependencies are installed - # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun - - run: pnpm dlx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build" - - - # Cache node_modules - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'pnpm' - - - run: pnpm install --frozen-lockfile - - uses: nrwl/nx-set-shas@v4 - - # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud - # - run: pnpm exec nx-cloud record -- echo Hello World - # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected - - run: pnpm exec nx affected -t lint test build diff --git a/.github/workflows/deploy-to-github-pages.yml b/.github/workflows/deploy-to-github-pages.yml new file mode 100644 index 0000000..4dc1bb7 --- /dev/null +++ b/.github/workflows/deploy-to-github-pages.yml @@ -0,0 +1,66 @@ +name: Deploy static content to Pages + +on: + push: + branches: [main] + + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: 'pages' + cancel-in-progress: true + +env: + NODE_OPTIONS: --max-old-space-size=6144 + +jobs: + deploy: + defaults: + run: + working-directory: ./docs + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22.x + + - name: Install PNPM + run: npm i pnpm -g + + - name: Cache node_modules Directory + uses: actions/cache@v4 + id: node_modules-cache + with: + path: node_modules + key: ${{ runner.OS }}-node_modules-cache-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/pnpm-lock.yaml') }} + + - name: Install dependencies + run: pnpm i + + - name: Build + run: pnpm build + + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./docs/build + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4