forked from getzola/zola
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
1,448 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
+++ | ||
title = "Cloudflare Pages" | ||
weight = 60 | ||
+++ | ||
|
||
Cloudflare is a cloud solutions provider with a huge proprietary content delivery network. Like Netlify or Vercel Cloudflare Pages makes deployment process flexible and easy. You can add GitHub repo to the service and build&host Zola-bases websites after each PR automatically. | ||
|
||
## Step-by-step | ||
|
||
1. Open or create the new one Cloudflare account and choice Pages on the right nav column | ||
2. Press the button _"Create a project"_ | ||
3. Select the GitHub repo that contains your Zola website and connect it to Cloudflare Pages | ||
4. Click _"Begin setup"_ | ||
5. Enter your project name and keep in mind, if you would like to use default Pages domain (pages.dev) it will be your website future URL, like `yourprojectname.pages.dev`. Also, select a production branch. | ||
6. In _Build settings_ select Zola as a _Framework preset_. _Build command_ and _Build output directory_ will be filled automatically. | ||
7. Toggle _Environment variables_ below and add `ZOLA_VERSION` as _a variable name_ and `0.13.0` or an actual Zola's version as a _value_. | ||
8. Save and deploy. | ||
|
||
Your website is now built and deployed to Pages. You may add custom domain or change some settings in the Pages dashboard. | ||
|
||
Also, you may find well documented settings and howto [Getting started with Cloudflare Pages](https://developers.cloudflare.com/pages/getting-started) and | ||
[Deloying Zola with Cloudflare Pages](https://developers.cloudflare.com/pages/how-to/deploy-a-zola-site#deploying-with-cloudflare-pages) in Developers portal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,22 @@ weight = 30 | |
By default, GitHub Pages uses Jekyll (a ruby based static site generator), | ||
but you can also publish any generated files provided you have an `index.html` file in the root of a branch called | ||
`gh-pages` or `master`. In addition you can publish from a `docs` directory in your repository. That branch name can | ||
also be manually changed in the settings of a repository. | ||
also be manually changed in the settings of a repository. To serve a site at `<username>.github.io` or | ||
`<organization>.github.io`, you must name the repository `<username>.github.io` or | ||
`<organization>.github.io` (otherwise GitHub will append the repository name to the URL, e.g.: | ||
`<username>.github.io/<repositoryname>`. | ||
|
||
We can use any continuous integration (CI) server to build and deploy our site. For example: | ||
|
||
* [Github Actions](#github-actions) | ||
* [Travis CI](#travis-ci) | ||
|
||
In either case, it seems to work best if you use `git submodule` to include your theme, e.g.: | ||
|
||
```shell | ||
git submodule add https://github.com/getzola/after-dark.git themes/after-dark | ||
``` | ||
|
||
## Github Actions | ||
|
||
Using *Github Actions* for the deployment of your Zola-Page on Github-Pages is pretty easy. You basically need three things: | ||
|
@@ -33,32 +42,65 @@ on: push | |
name: Build and deploy GH Pages | ||
jobs: | ||
build: | ||
name: shalzz/zola-deploy-action | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout | ||
- uses: actions/checkout@master | ||
# Build & deploy | ||
- name: shalzz/zola-deploy-action | ||
uses: shalzz/[email protected] | ||
env: | ||
# Target branch | ||
PAGES_BRANCH: gh-pages | ||
# Provide personal access token | ||
TOKEN: ${{ secrets.TOKEN }} | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
- name: build_and_deploy | ||
uses: shalzz/[email protected] | ||
env: | ||
# Target branch | ||
PAGES_BRANCH: gh-pages | ||
# Provide personal access token | ||
TOKEN: ${{ secrets.TOKEN }} | ||
``` | ||
This script is pretty simple, because the [zola-deploy-action](https://github.com/shalzz/zola-deploy-action) is doing everything for you. You just need to provide some details. For more configuration options check out the [README](https://github.com/shalzz/zola-deploy-action/blob/master/README.md). | ||
By commiting the action your first build is triggered. Wait until it's finished, then you should see in your repository a new branch *gh-pages* with the compiled *Zola* page in it. | ||
By committing the action your first build is triggered. Wait until it's finished, then you should see in your repository a new branch *gh-pages* with the compiled *Zola* page in it. | ||
Finally we need to check the *Github Pages* section of the repository settings. Click on the *Settings* tab and scroll down to the *Github Pages* section. Check if the source is set to *gh-pages* branch and the directory is */ (root)*. You should also see your *Github Pages* link. | ||
There you can also configure a *custom domain* and *Enforce HTTPS* mode. Before configuring a *custom domains*, please check out [this](https://github.com/shalzz/zola-deploy-action/blob/master/README.md#custom-domain). | ||
There you can also configure a *custom domain* and *Enforce HTTPS* mode. Before configuring a *custom domains*, please check out [this](https://github.com/shalzz/zola-deploy-action/blob/master/README.md#custom-domain). | ||
If you want to keep the source of your site in a private repository (including, for example, draft | ||
posts), adapt the following `.github/workflows/main.yml`: | ||
|
||
```yaml | ||
on: push | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.ref != 'refs/heads/main' | ||
steps: | ||
- name: 'checkout' | ||
uses: actions/checkout@v2 | ||
- name: 'build' | ||
uses: shalzz/[email protected] | ||
env: | ||
PAGES_BRANCH: gh-pages | ||
BUILD_DIR: . | ||
TOKEN: ${{ secrets.TOKEN }} | ||
# BUILD_ONLY: true | ||
build_and_deploy: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
steps: | ||
- name: 'checkout' | ||
uses: actions/checkout@v2 | ||
- name: 'build and deploy' | ||
uses: shalzz/[email protected] | ||
env: | ||
PAGES_BRANCH: master | ||
BUILD_DIR: . | ||
TOKEN: ${{ secrets.PUBLIC_TOKEN }} | ||
REPOSITORY: username/username.github.io | ||
``` | ||
by substituting your username or organization. | ||
|
||
## Travis CI | ||
|
||
We are going to use [Travis CI](https://travis-ci.org) to automatically publish the site. If you are not using Travis | ||
Alternatively, you can use [Travis CI](https://www.travis-ci.com/) to automatically publish the site. If you are not using Travis | ||
already, you will need to login with the GitHub OAuth and activate Travis for the repository. | ||
Don't forget to also check if your repository allows GitHub Pages in its settings. | ||
|
||
|
@@ -72,7 +114,7 @@ submodules. When doing this, ensure that you are using the `https` version of th | |
$ git submodule add {THEME_URL} themes/{THEME_NAME} | ||
``` | ||
|
||
## Allowing Travis to push to GitHub | ||
### Allowing Travis to push to GitHub | ||
|
||
Before pushing anything, Travis needs a Github private access key to make changes to your repository. | ||
If you're already logged in to your account, just click [here](https://github.com/settings/tokens) to go to | ||
|
@@ -86,7 +128,7 @@ Copy it into your clipboard and head back to Travis. | |
Once on Travis, click on your project, and navigate to "Settings". Scroll down to "Environment Variables" and input a name of `GH_TOKEN` with a value of your access token. | ||
Make sure that "Display value in build log" is off, and then click add. Now Travis has access to your repository. | ||
|
||
## Setting up Travis | ||
### Setting up Travis | ||
|
||
We're almost done. We just need some scripts in a .travis.yml file to tell Travis what to do. | ||
|
||
|
@@ -98,7 +140,7 @@ language: minimal | |
before_script: | ||
# Download and unzip the zola executable | ||
# Replace the version numbers in the URL by the version you want to use | ||
- curl -s -L https://github.com/getzola/zola/releases/download/v0.9.0/zola-v0.9.0-x86_64-unknown-linux-gnu.tar.gz | sudo tar xvzf - -C /usr/local/bin | ||
- curl -s -L https://github.com/getzola/zola/releases/download/v0.13.0/zola-v0.13.0-x86_64-unknown-linux-gnu.tar.gz | sudo tar xvzf - -C /usr/local/bin | ||
script: | ||
- zola build | ||
|
@@ -117,4 +159,4 @@ after_success: | | |
If your site is using a custom domain, you will need to mention it in the `ghp-import` command: | ||
`ghp-import -c vaporsoft.net -n public` for example. | ||
|
||
Credits: this page is based on the article https://vaporsoft.net/publishing-gutenberg-to-github/ | ||
Credits: The Travis-CI section of this page is based on the article https://vaporsoft.net/publishing-gutenberg-to-github/ |
Oops, something went wrong.