From 9b99dfaf03a8c839f0608c341893d4d981cb73db Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:37:12 +0200 Subject: [PATCH] chore: nix in actions, deploy website after API reference update (#136) --- .github/workflows/website-deploy.yml | 16 +++++--------- .github/workflows/website-test-deploy.yml | 19 ++++++---------- .../website-update-api-reference.yml | 22 +++++++++++++++++-- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/.github/workflows/website-deploy.yml b/.github/workflows/website-deploy.yml index 132403f8..b553e7dd 100644 --- a/.github/workflows/website-deploy.yml +++ b/.github/workflows/website-deploy.yml @@ -6,6 +6,7 @@ on: - main paths: - 'website/**' + workflow_dispatch: jobs: deploy: @@ -14,23 +15,18 @@ jobs: permissions: contents: write steps: + - uses: DeterminateSystems/nix-installer-action@v12 + - uses: DeterminateSystems/magic-nix-cache-action@v7 - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Install yarn - run: npm install -g yarn - - name: Install dependencies + - name: Install Dependencies run: | cd website yarn install --frozen-lockfile - - - name: Build website + - name: Build Website run: | cd website - yarn build + nix-shell -p yarn --run "yarn build" # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus - name: Deploy to GitHub Pages diff --git a/.github/workflows/website-test-deploy.yml b/.github/workflows/website-test-deploy.yml index 405e4aa9..2078151a 100644 --- a/.github/workflows/website-test-deploy.yml +++ b/.github/workflows/website-test-deploy.yml @@ -9,23 +9,18 @@ on: jobs: test-deploy: - name: Test deployment + name: Test Deployment runs-on: ubuntu-latest steps: + - uses: DeterminateSystems/nix-installer-action@v12 + - uses: DeterminateSystems/magic-nix-cache-action@v7 - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Install yarn - run: npm install -g yarn - - - name: Install dependencies + - name: Install Dependencies run: | cd website - yarn install --frozen-lockfile - - - name: Test build + nix-shell -p yarn --run "yarn install --frozen-lockfile" + - name: Test Build run: | cd website - yarn build + nix-shell -p yarn --run "yarn build" diff --git a/.github/workflows/website-update-api-reference.yml b/.github/workflows/website-update-api-reference.yml index 0034a59c..e8647e87 100644 --- a/.github/workflows/website-update-api-reference.yml +++ b/.github/workflows/website-update-api-reference.yml @@ -13,13 +13,13 @@ jobs: - uses: DeterminateSystems/nix-installer-action@v12 - uses: DeterminateSystems/magic-nix-cache-action@v7 - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Build the API reference run: | cd website npm install spectaql npx spectaql spectaql-config.yml -t static -f api-reference.html + - name: Deploy the API reference run: | git config --local user.name 'github-actions[bot]' @@ -27,3 +27,21 @@ jobs: git add website/static/api-reference.html git commit -m "docs: api reference update: $GITHUB_SHA" git push origin HEAD:main + + - name: Install Website Dependencies + run: | + cd website + nix-shell -p yarn --run "yarn install --frozen-lockfile" + + - name: Build Website + run: | + cd website + 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: ./website/build + user_name: github-actions[bot] + user_email: 41898282+github-actions[bot]@users.noreply.github.com