├── Dockerfile ├── LICENSE ├── README.md ├── action.yml └── entrypoint.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:16.8 2 | 3 | LABEL description "A GitHub Action to build a Marp Presentation website to GitHub Pages" 4 | LABEL repository "http://github.com/ralexander-phi/marp-action" 5 | 6 | RUN apt update && apt install -y git 7 | 8 | RUN npm install -g @marp-team/marp-cli@1.4.0 9 | 10 | ENV IS_DOCKER true 11 | 12 | ADD entrypoint.sh /entrypoint.sh 13 | RUN chmod +x /entrypoint.sh 14 | ENTRYPOINT ["/entrypoint.sh"] 15 | 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Robert Alexander 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # marp-action 2 | 3 | ## :exclamation: Deprecated :exclamation: 4 | 5 | This repo is now deprecated. 6 | 7 | Please see https://github.com/ralexander-phi/marp-to-pages/ for the current recommended approach. 8 | 9 | ## Description 10 | 11 | Publish your [Marp Presentation](https://marp.app/) to GitHub Pages automatically using a GitHub Action. 12 | 13 | ## 🚀 Getting Started 14 | 15 | Read through the [setup instructions](https://alexsci.com/test-marp-action/) to learn the process. You'll be using this [template repo](https://github.com/ralexander-phi/test-marp-action) as your starting point. 16 | 17 | ## 🔧 Configuration 18 | 19 | The Action can be configured using environment variables: 20 | 21 | | Variable | Required | Description | 22 | | --- | --- | --- | 23 | | GITHUB_REPOSITORY | x | The repo to publish the rendered slides to | 24 | | GITHUB_TOKEN | x | An access to token that allows pushing to GITHUB_REPOSITORY | 25 | | PUBLISH_TO_BRANCH | x | The branch to commit the slides on. Likely `main` or ` gh-pages` | 26 | | NO_FORCE_PUSH | | Per default the action force-pushes - when working with others, or other actions that commit to the same branch this can be set to `true` to ensure the Action fails rather than overwrites changes that happened while it ran. Defaults to `false` | 27 | | COMMIT_MSG | | A message to use for the automated commit. Defaults to `Marp Action Build` | 28 | | MARP_ARGS | | Any arguments to pass directly to marp | 29 | 30 | ## 💻 Local development 31 | 32 | docker build -t marp-action ./ 33 | docker run -t marp-action 34 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: marp-action 2 | description: 'Build your Marp presentation into a GitHub Pages site' 3 | branding: 4 | icon: 'send' 5 | color: 'green' 6 | runs: 7 | using: 'docker' 8 | image: 'Dockerfile' 9 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | EMOJI_WORKING=( 6 | "👷 Working..." 7 | "🏃 Running..." 8 | "🏗 Building..." 9 | "🚧 Building..." 10 | ) 11 | STARTING_MESSAGE=${EMOJI_WORKING[$[$RANDOM % ${#EMOJI_WORKING[@]}]]} 12 | 13 | EMOJI_SUCCESS=( 14 | "💯 Done!" 15 | "🚢 Ship it!" 16 | "🚀 Awesome!" 17 | ) 18 | SUCCESS_MESSAGE=${EMOJI_SUCCESS[$[$RANDOM % ${#EMOJI_SUCCESS[@]}]]} 19 | 20 | echo "$STARTING_MESSAGE" 21 | echo "" 22 | 23 | echo " Building with marp..." 24 | echo "" 25 | marp ${MARP_ARGS} 26 | echo "✔ Built Successfully!" 27 | echo "" 28 | 29 | echo " Publishing to ${GITHUB_REPOSITORY} ${PUBLISH_TO_BRANCH}..." 30 | echo "" 31 | 32 | remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" && \ 33 | git init && \ 34 | git config user.name "marp-action" && \ 35 | git config user.email "marp-action@users.noreply.github.com" && \ 36 | git add . && \ 37 | git status && \ 38 | curr_branch="$(git rev-parse --abbrev-ref HEAD)" && \ 39 | commit_msg="${COMMIT_MSG:-'Marp Action Build'}" && \ 40 | git commit -m "${commit_msg}" 41 | 42 | if [ "$NO_FORCE_PUSH" = true ] 43 | then 44 | git push $remote_repo ${curr_branch}:${PUBLISH_TO_BRANCH} 45 | else 46 | git push --force $remote_repo ${curr_branch}:${PUBLISH_TO_BRANCH} 47 | fi 48 | 49 | echo "✔ Pushed Successfully!" 50 | echo "" 51 | 52 | echo "$SUCCESS_MESSAGE" 53 | 54 | --------------------------------------------------------------------------------