From 29b60df0f08a4a4313fb6ddba3a6eab93de46e3a Mon Sep 17 00:00:00 2001 From: openoms Date: Tue, 25 Jun 2024 14:56:45 +0200 Subject: [PATCH] chore: nix in actions, deploy website after API reference update --- .github/workflows/deploy.yml | 20 ++++++++---------- .github/workflows/test-deploy.yml | 21 ++++++++----------- .../workflows/update-admin-api-reference.yml | 17 +++++++++++++++ .../workflows/update-public-api-reference.yml | 17 +++++++++++++++ 4 files changed, 52 insertions(+), 23 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9ddfef2f..533ad235 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,8 +4,7 @@ on: push: branches: - main - # Review gh actions docs if you want to further define triggers, paths, etc - # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on + workflow_dispatch: jobs: deploy: @@ -14,16 +13,15 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 20 - cache: yarn + - uses: DeterminateSystems/nix-installer-action@v12 + - uses: DeterminateSystems/magic-nix-cache-action@v7 + - uses: actions/checkout@v4 + + - name: Install Dependencies + run: nix-shell -p yarn --run "yarn install --frozen-lockfile" - - name: Install dependencies - run: yarn install --frozen-lockfile - - name: Build website - run: yarn build + - name: Build + run: nix-shell -p yarn --run "yarn build" # Popular action to deploy to GitHub Pages: # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index de45968f..30a31262 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -4,21 +4,18 @@ on: pull_request: branches: - main - # Review gh actions docs if you want to further define triggers, paths, etc - # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on jobs: test-deploy: - name: Test deployment + name: Test Deployment runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 20 - cache: yarn + - uses: DeterminateSystems/nix-installer-action@v12 + - uses: DeterminateSystems/magic-nix-cache-action@v7 + - uses: actions/checkout@v4 - - name: Install dependencies - run: yarn install --frozen-lockfile - - name: Test build website - run: yarn build + - name: Install Dependencies + run: nix-shell -p yarn --run "yarn install --frozen-lockfile" + + - name: Test Build + run: nix-shell -p yarn --run "yarn build" diff --git a/.github/workflows/update-admin-api-reference.yml b/.github/workflows/update-admin-api-reference.yml index 28b728ee..075613ab 100644 --- a/.github/workflows/update-admin-api-reference.yml +++ b/.github/workflows/update-admin-api-reference.yml @@ -74,3 +74,20 @@ jobs: short_commit_hash=$(echo ${{ env.CURRENT_COMMIT_HASH }} | cut -c 1-7) git commit -m "docs: admin api reference update to blink commit $short_commit_hash" git push origin main + + - uses: DeterminateSystems/nix-installer-action@v12 + - uses: DeterminateSystems/magic-nix-cache-action@v7 + + - name: Install Dependencies + run: nix-shell -p yarn --run "yarn install --frozen-lockfile" + + - name: Build + run: nix-shell -p yarn --run "yarn build" + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build + user_name: github-actions[bot] + user_email: 41898282+github-actions[bot]@users.noreply.github.com diff --git a/.github/workflows/update-public-api-reference.yml b/.github/workflows/update-public-api-reference.yml index 9dff24f2..ce411962 100644 --- a/.github/workflows/update-public-api-reference.yml +++ b/.github/workflows/update-public-api-reference.yml @@ -74,3 +74,20 @@ jobs: short_commit_hash=$(echo ${{ env.CURRENT_COMMIT_HASH }} | cut -c1-7) git commit -m "docs: public api reference update to blink commit $short_commit_hash" git push origin main + + - uses: DeterminateSystems/nix-installer-action@v12 + - uses: DeterminateSystems/magic-nix-cache-action@v7 + + - name: Install Dependencies + run: nix-shell -p yarn --run "yarn install --frozen-lockfile" + + - name: Build + run: nix-shell -p yarn --run "yarn build" + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build + user_name: github-actions[bot] + user_email: 41898282+github-actions[bot]@users.noreply.github.com