Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create GitHub Action to automatically run make all #65

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/actions/publish/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
19 changes: 19 additions & 0 deletions .github/actions/publish/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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 }}