Skip to content

Commit

Permalink
Working (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ralexander-phi committed Mar 17, 2020
1 parent 8ff98cc commit c8e3204
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:13.10

LABEL description "A GitHub Action to build a Marp Presentation website to GitHub Pages"
LABEL repository "http:https://github.com/ralexander-phi/marp-action"

RUN apt update && apt install -y git

RUN npm install -g @marp-team/[email protected]

ENV IS_DOCKER true

ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# marp-action

Build a Marp Presentation Website from a repo


## Inputs

* MARP\_ARGS - Build arguements for Marp
* GITHUB\_ACTOR - Who is performing actions (I.E. Jenkins)
* GITHUB\_REPOSITORY - The repository to push to
* GITHUB\_TOKEN - A GitHub application access token to use


## Example

MARP\_ARGS=slides.md -o index.html


## Local testing

docker build -t marp-action ./
docker run -t marp-action
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: marp-action
description: 'Build your Marp presentation into a GitHub Pages site'
branding:
icon: 'send'
color: 'green'
runs:
using: 'docker'
image: 'Dockerfile'
45 changes: 45 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

set -e

EMOJI_WORKING=(
"👷 Working..."
"🏃 Running..."
"🏗 Building..."
"🚧 Building..."
)
STARTING_MESSAGE=${EMOJI_WORKING[$[$RANDOM % ${#EMOJI_WORKING[@]}]]}

EMOJI_SUCCESS=(
"💯 Done!"
"🚢 Ship it!"
"🚀 Awesome!"
)
SUCCESS_MESSAGE=${EMOJI_SUCCESS[$[$RANDOM % ${#EMOJI_SUCCESS[@]}]]}

echo "$STARTING_MESSAGE"
echo ""

echo " Building with marp..."
echo ""
marp ${MARP_ARGS}
echo "✔ Built Successfully!"
echo ""

echo " Publishing to ${GITHUB_REPOSITORY} ${REMOTE_BRANCH}..."
echo ""

remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" && \
git init && \
git config user.name "marp-action" && \
git config user.email "[email protected]" && \
git add . && \
git status && \
git commit -m'action build' && \
git push --force $remote_repo master:${PUBLISH_TO_BRANCH}

echo "✔ Pushed Successfully!"
echo ""

echo "$SUCCESS_MESSAGE"

0 comments on commit c8e3204

Please sign in to comment.