How to Automatically Publish a Blog Using GitHub Actions

In this post, I used Travis to enable automatic blog publishing. However, I recently discovered that Travis does not run automatically anymore (though it works manually). I haven’t looked into it closely because GitHub Actions have been introduced, so I decided to move all dependencies to GitHub. Go Action Click on Actions on the repository page, and then New Workflow to see recommended actions. Since this blog uses Go code, it shows the Go Action. ...

December 16, 2020 · 2 min · 331 words · Jack Yu

How to Execute Git Push in Travis CI

Background Travis CI is generally used for automating tests without needing to update the repository with the test outputs. This article explains how to automatically commit the results from Travis CI. Process The basic process references this gist. Below is the .travis.yml from the gist. language: ruby rvm: - 2.0.0 env: global: - USER="username" - EMAIL="[email protected]" - REPO="name of target repo" - FILES="README.md foo.txt bar.txt" - GH_REPO="github.com/${USER}/${REPO}.git" - secure: "put travis gem output here => http://docs.travis-ci.com/user/encryption-keys/" script: - ruby test.rb after_success: - MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT) - git clone git://${GH_REPO} - mv -f ${FILES} ${REPO} - cd ${REPO} - git remote - git config user.email ${EMAIL} - git config user.name ${USER} - git add ${FILES} - git commit -m "${MESSAGE}" - git push "https://${GH_TOKEN}@${GH_REPO}" master > /dev/null 2>&1 Note here that MESSAGE should be quoted when committing, which the original gist did not include. ...

October 16, 2017 · 4 min · 659 words · Jack Yu