-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ff98cc
commit c8e3204
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|