Skip to content

Commit

Permalink
Build gh-pages with github actions
Browse files Browse the repository at this point in the history
Try to get rid of travis ci.
  • Loading branch information
hupfdule committed Apr 17, 2022
1 parent e58b78c commit 5be9499
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ghpages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Github Pages

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: ./build_gh-pages.sh
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.github_token }}
15 changes: 4 additions & 11 deletions build_gh-pages.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#!/bin/bash

# Only generate gh-pages from master branch

GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
if [ "$TRAVIS_BRANCH" != "master" ] && [ "$GIT_BRANCH" != "master" ]
then
echo "Not on master branch. Not attempting to generate gh-pages. TRAVIS_BRANCH is: $TRAVIS_BRANCH GIT_BRANCH is: $GIT_BRANCH"
exit 0
fi
sudo gem install asciidoctor --version 1.5.8

# Don't create gh-pages from dirty working directory
if [ "`git status -s`" ]
Expand Down Expand Up @@ -54,12 +47,12 @@ popd
# Commit the new content
pushd "$GH_PAGES"
git add --all
git config user.name "travis@travis-ci.org";
git config user.email "Travis CI";
git config user.name "github-actions@github.org";
git config user.email "Github Actions";
git commit -m "[build_gh-pages.sh] Update gh-pages from ""$GIT_COMMIT_HASH"

# Push content
git push https://${GITHUB_ACCESS_TOKEN}@github.com/hupfdule/kilt.git
git push https://x-access-token:${GITHUB_ACCESS_TOKEN}@github.com/hupfdule/kilt.git

# Remove git worktree
popd
Expand Down

0 comments on commit 5be9499

Please sign in to comment.