diff --git a/.github/actions/publish/Dockerfile b/.github/actions/publish/Dockerfile new file mode 100644 index 000000000..cd68f6014 --- /dev/null +++ b/.github/actions/publish/Dockerfile @@ -0,0 +1,16 @@ +FROM ubuntu:bionic + +LABEL "name"="Run make scripts and push changes" +LABEL "maintainer"="Winston Liu" +LABEL "version"="0.0.1" + +LABEL "com.github.actions.name"="Run make scripts and push changes" +LABEL "com.github.actions.description"="Run `make all` to post-process all files and then push changes" +LABEL "com.github.actions.icon"="package" +LABEL "com.github.actions.color"="green" + +RUN apt-get update > /dev/null && apt-get -yqq install git make pandoc astyle source-highlight > /dev/null + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/publish/entrypoint.sh b/.github/actions/publish/entrypoint.sh new file mode 100755 index 000000000..6608952e4 --- /dev/null +++ b/.github/actions/publish/entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +make all + +# Frankly, we don't care about file mode changes +git config core.filemode false + +git add --all +staged_lines=`git diff --cached --numstat | wc -l` +if [ "$staged_lines" -eq "0" ]; then + exit 0 +fi + +git config user.name "Github Actions" +git config user.email "actions@github.com" + +git commit -m "Post-process files" + +git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}" HEAD:master diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..2cba4ec10 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,17 @@ +name: Publish + +on: + push: + branches: + - master + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: ./.github/actions/publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}