Tuesday 27 December 2022
Create a Repository ¶
Assuming your user name on github is user-name
:
- Create a repository in your account called user-name.github.io : https://github.com/new
- Go to repository Settings (last tab on top of the repository)
- Go to Pages from the sidebar under Code and automation
- Under Build and deployment > Source choose Github Actions
Create A Home page ¶
- Go to your repository Code page (first tab at the top of the repository)
- Click Add file > Create new file
- Name your file: index.md
- Add any content to your file. for example: Hello world!
- Click Commit new file
Add Github workflow ¶
- Go to your repository Code page
- Click Add file > Create new file
- Name your file .github/workflows/xlog.yml
- Add The following content to your file
name: Xlog
on:
push:
branches: [ "master" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: restore timestamps
uses: chetan/git-restore-mtime-action@v1
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
check-latest: true
- name: Install xlog
run: |
go install github.com/emad-elsaid/xlog/cmd/xlog@latest
- name: Build
run: |
xlog \
--build . \
--sitename "user-name"
rm *.md
chmod -R 0777 .
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v1.0.4
with:
path: .
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@v1
- if your main branch name is different than
master
please change it in the previous file. - Make sure you replace any occurrence of user-name with your user name.
- Click Commit new file
- Go to Actions tab. you should find a run in progress. After it completes move to the next step.
Visiting your digital garden ¶
- Now your digital garden should be available under user-name.github.io
- Visit the previous URL to make sure everything works
- If the page doesn’t appear with Hello world! content (or the content you wrote) then something is wrong with the previous steps.
Writing new pages ¶
- When you want to add a new page to your garden add the file in your repository and make sure it’s in .md (Markdown) format.
- After Github fisinish building the page should be served as HTML with the same name without .md extension
- For example about.md will be served as /about
- keep your files names meaningful. as Xlog will autolink pages together by the file name.
- so in any page when you have the word about in the text, Xlog will convert it to a link to the about page.