zola icon indicating copy to clipboard operation
zola copied to clipboard

Confused about deploy on Github Pages

Open HappyClem opened this issue 2 years ago • 15 comments

Hello, I am new to this and the issue I have is 100 % my fault but I do not understand how to fix it.

I want to put my Zola folder on github or gitlab pages (let's say github). Should I create a repo and start the procedures in it or should I create the Zola website and then upload it to github ? I tried for several hours yesterday and I am confused with the themes because in the themes folders there is already a .git.

What procedures did I try ?

  1. Create a git repo and then install Zola
  • First I create a repo named "test-zola.github.io"

  • I clone this repo on my computer (Documents\zola-test)

  • I then launch the install process from the repo folder with zola init followed by zola serve Now I have a zola install working with no themes

  • I install a theme ("adidoks") using git clone on the themes folder and adding it in the config file Here is the first confusion, now I have "Documents\zola-test" with .git and config file, and within the "themes" folder I have "adidoks" with also .git and config file

  • I push everything on github

  • I add submodule with Documents\zola-test>git submodule add https://github.com/HappyClem/zola-test.github.io.git themes/adidoks -I push again to github

  • I create a token that I add in the secret settings under the name "TOKEN"

  • I go on the "actions" tab and create a workflow by copy-pasting from the documentation Aftre a few seconds, the worfklow do not work with this message :

Starting deploy... Fetching themes Submodule 'themes/adidoks' (https://github.com/HappyClem/zola-test.github.io.) registered for path 'themes/adidoks' Cloning into '/github/workspace/themes/adidoks'... fatal: could not read Username for 'https://github.com': No such device or address fatal: clone of 'https://github.com/HappyClem/zola-test.github.io.' into submodule path '/github/workspace/themes/adidoks' failed Failed to clone 'themes/adidoks'. Retry scheduled Cloning into '/github/workspace/themes/adidoks'... fatal: could not read Username for 'https://github.com': No such device or address fatal: clone of 'https://github.com/HappyClem/zola-test.github.io.' into submodule path '/github/workspace/themes/adidoks' failed Failed to clone 'themes/adidoks' a second time, aborting

  • In the "pages" tab, I only have the option for the master branch with /root directory

Note : The website is "as is", I did not create or modify any files except config for the themes. You can check the file I left the test repo up.

Can i have some help ? I hope this is the right place.

HappyClem avatar Jul 29 '21 07:07 HappyClem

I add submodule with Documents\zola-test>git submodule add https://github.com/HappyClem/zola-test.github.io.git themes/adidoks

Shouldn't this be git submodule add https://github.com/aaranxu/adidoks.git themes/adidoks?

coastalwhite avatar Jul 29 '21 09:07 coastalwhite

I add submodule with Documents\zola-test>git submodule add https://github.com/HappyClem/zola-test.github.io.git themes/adidoks

Shouldn't this be git submodule add https://github.com/aaranxu/adidoks.git themes/adidoks?

'themes/adidoks' already exists in the index Does that mean it's okay ? There is a gitignore with "public" in it so there isn't any folder showing up.

HappyClem avatar Jul 29 '21 11:07 HappyClem

I would delete the themes/adidoks folder and run git submodule add https://github.com/aaranxu/adidoks.git themes/adidoks again. Then commit and push.

If you cannot use the zola serve command anymore, run git submodule update --init.

coastalwhite avatar Jul 29 '21 16:07 coastalwhite

@coastalwhite This commands make the actions works ! That's improvement, thanks. In the "pages" tab tho, I got this error Your site is having problems building: The tag import on line 25 in themes/adidoks/content/blog/math-typesetting.md is not a recognized Liquid tag

HappyClem avatar Jul 30 '21 06:07 HappyClem

I think that is more of an issue with aaranxu/adidoks. I would suggest leaving an issue there.

coastalwhite avatar Jul 30 '21 08:07 coastalwhite

I tried with other themes and got others errors ^^'

Error: Failed to render section 'C:\Users\libre-service\Documents\zola-test\content\_index.md' Reason: Failed to render 'index.html' Reason: Variable paginator.pages not found in context while rendering 'index.html'

HappyClem avatar Jul 30 '21 09:07 HappyClem

This error means the theme is expecting paginated content so if you didn't paginate your content you will get this error, details on https://www.getzola.org/documentation/content/section/ on how to set it

Keats avatar Jul 30 '21 09:07 Keats

This error means the theme is expecting paginated content so if you didn't paginate your content you will get this error, details on https://www.getzola.org/documentation/content/section/ on how to set it

I did not do anything apart installing zola yet because I wanted to be able to make it with a friends remotely so modifying it after installing it on github. Do i need to make some content or modification before putting in up ?

HappyClem avatar Jul 30 '21 11:07 HappyClem

Do i need to make some content or modification before putting in up ?

In theory themes should explain in their README what to configure to make them work like https://github.com/getzola/after-dark#installation Maybe try to use one of the themes available from https://github.com/getzola those should be documented although I need to re-test them for 0.14.

Keats avatar Jul 30 '21 16:07 Keats

I am also struggling to deploy to github pages, this seems like a very useful feature (easy and free blogging) and the documentation is too terse for beginners.

matthiasdebernardini avatar Jun 15 '22 23:06 matthiasdebernardini

I'm using this and it works good, careful if you have autogenerated .gitignore, that might fail the cli in weird ways

name: Deploy to Pages

on:
  # Runs on pushes targeting the default branch
  push:
    branches: ["main"]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
  group: "pages"
  cancel-in-progress: false

# Default to bash
defaults:
  run:
    shell: bash

jobs:
  # Build job
  build:
    runs-on: ubuntu-latest
    env:
        ZOLA_VERSION: "0.17.2"
    steps:
      - name: Install Zola
        run: |
          set -x
          wget -O - \
            "https://github.com/getzola/zola/releases/download/v${ZOLA_VERSION}/zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz" \
          | sudo tar xzf - -C /usr/local/bin          
      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: recursive
      - name: Setup Pages
        id: pages
        uses: actions/configure-pages@v3
      - name: Build with Zola
        run: |
                    zola build
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v1
        with:
          path: ./public

  # Deployment job
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v2

astrale-sharp avatar Sep 25 '23 13:09 astrale-sharp

I'm a bit confused about the hard part about deploying to GH. I've followed the docs for all my sites (getzola.org included) and it was easy

Keats avatar Sep 26 '23 08:09 Keats

was it recently? @Keats

matthiasdebernardini avatar Sep 26 '23 14:09 matthiasdebernardini

From memory, I copied my working .yaml from the internet but the official one didn't work, this was already a week ago so not sure if something else was in the way

astrale-sharp avatar Sep 26 '23 17:09 astrale-sharp

Yeah it was last month: https://github.com/getzola/zola/commit/4785ab2552998a1afb455fe56e88b73d11c5ead3

Keats avatar Sep 26 '23 19:09 Keats