-
Notifications
You must be signed in to change notification settings - Fork 45
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
1 parent
f1134af
commit 2f9fa45
Showing
14 changed files
with
256 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. | ||
# More: https://editorconfig.org/ | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
charset = utf-8 | ||
end_of_line = lf | ||
|
||
[Makefile] | ||
indent_style = tab |
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,17 @@ | ||
name: Branch Deleted | ||
|
||
on: delete | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
ref: hakyll | ||
|
||
- name: Remove deployment for deleted branch | ||
run: | | ||
./.github/workflows/deployment/delete.sh ${{ github.event.ref }} |
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,52 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- gh-pages | ||
pull_request: | ||
branches-ignore: | ||
- gh-pages | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
stack: ["2.7.3"] | ||
ghc: ["8.10.7"] | ||
|
||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: haskell/actions/setup@v1 | ||
name: Setup Haskell Stack | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
stack-version: ${{ matrix.stack }} | ||
|
||
- uses: actions/cache@v1 | ||
name: Cache ~/.stack | ||
with: | ||
path: ~/.stack | ||
key: ${{ runner.os }}-${{ matrix.ghc }}-stack | ||
|
||
- name: Build dependencies | ||
run: stack build --system-ghc --only-dependencies | ||
|
||
- name: Build site | ||
run: | | ||
stack build --system-ghc | ||
stack exec --system-ghc site rebuild | ||
- name: Deploy site | ||
run: | | ||
./.github/workflows/deployment/deploy.sh |
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,59 @@ | ||
#!/usr/bin/env bash | ||
|
||
export repo_root_dir=$(git rev-parse --show-toplevel) | ||
export site_src="${repo_root_dir}/_site" | ||
export gh_pages_dir="${repo_root_dir}/docs" | ||
export deployments_dir="${gh_pages_dir}/branches" | ||
|
||
# Site built from the main branch will be available at 'https://<domain_name>/'. | ||
# Sites built from other branchs will be available at 'https://<domain_name>/branches/<branch_name>'. | ||
export main_git_branch="hakyll" | ||
|
||
# replace "/", "#", etc with "-". | ||
slugify() { | ||
echo "$1" | iconv -c -t ascii//TRANSLIT | sed -E 's/[~^]+/-/g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$/-/g' | tr A-Z a-z | ||
} | ||
export -f slugify | ||
|
||
git config user.name github-actions | ||
git config user.email [email protected] | ||
|
||
update_deployments_list() { | ||
github_project_url=$(git remote get-url origin) | ||
if [[ $github_project_url == [email protected]:* ]]; then | ||
github_repo=$(echo ${github_project_url#"[email protected]:"} | sed 's/\.git$//g') | ||
elif [[ $github_project_url == https://github.com/* ]]; then | ||
github_repo=$(echo ${github_project_url#"https://github.com/"} | sed 's/\.git$//g' | sed 's/^\/\///g') | ||
fi | ||
|
||
github_repo_owner=$(echo "${github_repo}" | sed 's/\/.*$//g') | ||
github_repo_name=$(echo "${github_repo}" | sed 's/^.*\///g') | ||
|
||
deployments_list="DEPLOYMENTS.md" | ||
echo "Updating ${deployments_list}" | ||
rm $deployments_list | ||
|
||
# Create a markdown table | ||
touch $deployments_list | ||
echo "# Deployments" >>$deployments_list | ||
echo "" >>$deployments_list | ||
echo "| Branch | Link |" >>$deployments_list | ||
echo "| --- | --- |" >>$deployments_list | ||
|
||
main_deployment_url="https://${github_repo_owner}.github.io/${github_repo_name}/" | ||
echo "| [${main_git_branch}](https://github.com/${github_repo_owner}/${github_repo_name}/tree/${branch}) | [Open](${main_deployment_url}) |" >>$deployments_list | ||
|
||
remote_branches=$(git ls-remote --heads origin | sed 's?.*refs/heads/??' | grep -v "gh-pages" | grep -v "${main_git_branch}") | ||
echo "$remote_branches" | while IFS= read -r branch; do | ||
branch_slug=$(slugify $branch) | ||
deployment_url="https://${github_repo_owner}.github.io/${github_repo_name}/branches/${branch_slug}" | ||
echo "| [${branch}](https://github.com/${github_repo_owner}/${github_repo_name}/tree/${branch}) | [Open](${deployment_url}) |" >>$deployments_list | ||
done | ||
|
||
# Update gh-pages branch | ||
git add --all | ||
git commit --allow-empty -m "Update ${deployments_list} [ci skip]" | ||
git push --force origin gh-pages | ||
} | ||
|
||
export -f update_deployments_list |
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Remove deployment by specified git branch name. | ||
|
||
set -eo pipefail | ||
|
||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
source $script_dir/commons.sh | ||
|
||
git checkout gh-pages | ||
git pull origin gh-pages | ||
|
||
branch_slug=$(slugify $1) | ||
rm -rf "$deployments_dir/$branch_slug" | ||
|
||
echo "Updating gh-pages branch." | ||
git add --all | ||
git commit --allow-empty -m "Delete '$1' branch deployment [ci skip]" | ||
git push --force origin gh-pages | ||
echo "Deployment for branch '$1' has been deleted." | ||
|
||
update_deployments_list |
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,57 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Deploy static site to the GitHub pages. | ||
|
||
set -eo pipefail | ||
|
||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
source $script_dir/commons.sh | ||
|
||
deploy() { | ||
if [[ ! -z "$GITHUB_REF_NAME" ]]; then | ||
# The GITHUB_REF_NAME env variable is available in github actions. | ||
git_branch=$GITHUB_REF_NAME | ||
else | ||
git_branch=$(git branch --show-current) | ||
fi | ||
echo "Current git branch is '${git_branch}'." | ||
|
||
git checkout gh-pages | ||
git pull origin gh-pages | ||
|
||
if [ "$git_branch" == "$main_git_branch" ]; then | ||
site_dest="${gh_pages_dir}" | ||
|
||
# Create temporary backup for other branches content. | ||
mv "${deployments_dir}" . | ||
|
||
# Replace site files. | ||
rm -rf "${site_dest}" | ||
mkdir -p "${site_dest}" | ||
cp -a -v ${site_src}/* ${site_dest}/ | ||
|
||
# Restore temporary backup for other branches content. | ||
mv ./branches "${gh_pages_dir}/" | ||
else | ||
# Patch html files to tell search engine bots like google-bot not to index this content. | ||
# More info: https://developers.google.com/search/docs/advanced/crawling/block-indexing | ||
find $site_src -name '*.html' -exec sed -i 's/<head>/<head><meta name="robots" content="noindex, nofollow">/g' {} \; | ||
|
||
branch_slug=$(slugify $git_branch) | ||
site_dest="${gh_pages_dir}/branches/${branch_slug}" | ||
|
||
# Replace site files. | ||
rm -rf "${site_dest}" | ||
mkdir -p "${site_dest}" | ||
cp -a -v ${site_src}/* ${site_dest}/ | ||
fi | ||
|
||
echo "Updating gh-pages branch." | ||
git add --all | ||
git commit --allow-empty -m "Update '${git_branch}' branch deployment [ci skip]" | ||
git push --force origin gh-pages | ||
echo "Deployment finished." | ||
} | ||
|
||
deploy | ||
update_deployments_list |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
title: FlipStone | ||
logo: /assets/images/sponsors/flipstone/flipstone-683.png | ||
srcset: /assets/images/sponsors/flipstone/flipstone-200.png 200w, /assets/images/sponsors/flipstone/flipstone-400.png 400w, /assets/images/sponsors/flipstone/flipstone-683.png 683w | ||
logo: ./assets/images/sponsors/flipstone/flipstone-683.png | ||
srcset: ./assets/images/sponsors/flipstone/flipstone-200.png 200w, ./assets/images/sponsors/flipstone/flipstone-400.png 400w, ./assets/images/sponsors/flipstone/flipstone-683.png 683w | ||
externalUrl: https://flipstone.com/ | ||
level: Functor | ||
--- |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
title: GitHub | ||
logo: /assets/images/sponsors/github/github-683.png | ||
srcset: /assets/images/sponsors/github/github-200.png 200w, /assets/images/sponsors/github/github-400.png 400w, /assets/images/sponsors/github/github-683.png 683w | ||
logo: ./assets/images/sponsors/github/github-683.png | ||
srcset: ./assets/images/sponsors/github/github-200.png 200w, ./assets/images/sponsors/github/github-400.png 400w, ./assets/images/sponsors/github/github-683.png 683w | ||
externalUrl: https://github.com/ | ||
level: Monad | ||
--- |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
title: IOHK | ||
logo: /assets/images/sponsors/iohk/iohk-683.png | ||
srcset: /assets/images/sponsors/iohk/iohk-200.png 200w, /assets/images/sponsors/iohk/iohk-400.png 400w, /assets/images/sponsors/iohk/iohk-683.png 683w | ||
logo: ./assets/images/sponsors/iohk/iohk-683.png | ||
srcset: ./assets/images/sponsors/iohk/iohk-200.png 200w, ./assets/images/sponsors/iohk/iohk-400.png 400w, ./assets/images/sponsors/iohk/iohk-683.png 683w | ||
externalUrl: https://iohk.io/ | ||
level: Monad | ||
--- |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
title: Obsidian Systems | ||
logo: /assets/images/sponsors/obsidian-systems/obsidian-systems-683.png | ||
srcset: /assets/images/sponsors/obsidian-systems/obsidian-systems-200.png 200w, /assets/images/sponsors/obsidian-systems/obsidian-systems-400.png 400w, /assets/images/sponsors/obsidian-systems/obsidian-systems-683.png 683w | ||
logo: ./assets/images/sponsors/obsidian-systems/obsidian-systems-683.png | ||
srcset: ./assets/images/sponsors/obsidian-systems/obsidian-systems-200.png 200w, ./assets/images/sponsors/obsidian-systems/obsidian-systems-400.png 400w, ./assets/images/sponsors/obsidian-systems/obsidian-systems-683.png 683w | ||
externalUrl: https://obsidian.systems/ | ||
level: Applicative | ||
--- |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
title: Tweag | ||
logo: /assets/images/sponsors/tweag/tweag-683.png | ||
srcset: /assets/images/sponsors/tweag/tweag-200.png 200w, /assets/images/sponsors/tweag/tweag-400.png 400w, /assets/images/sponsors/tweag/tweag-683.png 683w | ||
logo: ./assets/images/sponsors/tweag/tweag-683.png | ||
srcset: ./assets/images/sponsors/tweag/tweag-200.png 200w, ./assets/images/sponsors/tweag/tweag-400.png 400w, ./assets/images/sponsors/tweag/tweag-683.png 683w | ||
externalUrl: https://tweag.io/ | ||
level: Applicative | ||
--- |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
title: Well-Typed | ||
logo: /assets/images/sponsors/well-typed/well-typed-683.png | ||
srcset: /assets/images/sponsors/well-typed/well-typed-200.png 200w, /assets/images/sponsors/well-typed/well-typed-400.png 400w, /assets/images/sponsors/well-typed/well-typed-683.png 683w | ||
logo: ./assets/images/sponsors/well-typed/well-typed-683.png | ||
srcset: ./assets/images/sponsors/well-typed/well-typed-200.png 200w, ./assets/images/sponsors/well-typed/well-typed-400.png 400w, ./assets/images/sponsors/well-typed/well-typed-683.png 683w | ||
externalUrl: https://well-typed.com/ | ||
level: Applicative | ||
--- |