Skip to content

Commit

Permalink
added workflow and actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Panda-Sharp committed Sep 11, 2019
1 parent c1f8041 commit 6ca9f3f
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/actions/docfx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu:18.04

LABEL "com.github.actions.name"="DocFX - Build and publish documentation"
LABEL "com.github.actions.description"="Builds and publishes documentation to GitHub Pages."
LABEL "com.github.actions.icon"="code"
LABEL "com.github.actions.color"="red"

LABEL "repository"="https://github.com/emiliano84/Toolkit.Docs"
LABEL "homepage"="https://emiliano84.github.io/Toolkit.Docs/"
LABEL "maintainer"="Emil <[email protected]>"

ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
14 changes: 14 additions & 0 deletions .github/actions/docfx/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'docfx'
description: 'Build Docs With DocFx'
# inputs:
# token: # id of input
# description: 'token'
# required: true
# outputs:
# time: # id of output
# description: 'The time we greeted you'
runs:
using: 'docker'
image: 'Dockerfile'
# args:
# - ${{ inputs.token }}
19 changes: 19 additions & 0 deletions .github/actions/docfx/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh -l

echo "Updating..."
apt-get update
apt-get install -y unzip wget gnupg gnupg2 gnupg1

# Install Mono
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list
apt update
apt install mono-complete --yes

# Get DocFX
wget https://github.com/dotnet/docfx/releases/download/v2.45/docfx.zip
unzip docfx.zip -d _docfx
# cd docs

# Build docs
mono _docfx/docfx.exe
10 changes: 10 additions & 0 deletions .github/actions/hello-world/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Container image that runs your code
FROM alpine:3.10

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]
16 changes: 16 additions & 0 deletions .github/actions/hello-world/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# action.yml
name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
who-to-greet: # id of input
description: 'Who to greet'
required: true
default: 'World'
outputs:
time: # id of output
description: 'The time we greeted you'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.who-to-greet }}
5 changes: 5 additions & 0 deletions .github/actions/hello-world/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh -l

echo "Hello $1"
time=$(date)
echo ::set-output name=time::$time
46 changes: 46 additions & 0 deletions .github/workflows/docfx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: DocFx
# This workflow is triggered on push to the repository.
on: [push]

jobs:
build:
# Job name is DocFx
name: Clone Repos
# This job runs on Linux
runs-on: ubuntu-latest
steps:
# Checkout
- uses: actions/checkout@v1
# with:
# path: 'ToolkitDocs'

# Clone
- name: Clone
run: git clone https://emiliano84:${{secrets.GITHUB_TOKEN}}@github.com/emiliano84/Toolkit.git ../Toolkit

# Hello
- name: Hello
run: echo ${HOME} ${GITHUB_ACTOR} ${GITHUB_REPOSITORY} ${GITHUB_WORKSPACE} ${GITHUB_SHA}
# ${{secrets.TOKEN}} ${{secrets.GITHUB_TOKEN}}

# Ls
- name: Ls
run: ls

# Ls ToolkitDocs
- name: Ls /home/runner/work/Toolkit.Docs
run: ls /home/runner/work/Toolkit.Docs

hello_world_job:
runs-on: ubuntu-latest
name: A job to say hello
steps:
# - uses: ./ # Uses an action in the root directory
- name: Hello world action step
id: hello
uses: emiliano84/Toolkit.Docs/.github/actions/hello-world@master
with:
who-to-greet: 'Mona the Octocat'
# Use the output from the `hello` step
- name: Get the output time
run: echo "The time was ${{ steps.hello.outputs.time }}"

0 comments on commit 6ca9f3f

Please sign in to comment.