diff --git a/.github/actions/docfx/Dockerfile b/.github/actions/docfx/Dockerfile new file mode 100644 index 0000000..ba122be --- /dev/null +++ b/.github/actions/docfx/Dockerfile @@ -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 " + +ADD entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/.github/actions/docfx/action.yml b/.github/actions/docfx/action.yml new file mode 100644 index 0000000..08431ab --- /dev/null +++ b/.github/actions/docfx/action.yml @@ -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 }} \ No newline at end of file diff --git a/.github/actions/docfx/entrypoint.sh b/.github/actions/docfx/entrypoint.sh new file mode 100644 index 0000000..e00256e --- /dev/null +++ b/.github/actions/docfx/entrypoint.sh @@ -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 diff --git a/.github/actions/hello-world/Dockerfile b/.github/actions/hello-world/Dockerfile new file mode 100644 index 0000000..757ea71 --- /dev/null +++ b/.github/actions/hello-world/Dockerfile @@ -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"] \ No newline at end of file diff --git a/.github/actions/hello-world/action.yml b/.github/actions/hello-world/action.yml new file mode 100644 index 0000000..0011139 --- /dev/null +++ b/.github/actions/hello-world/action.yml @@ -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 }} \ No newline at end of file diff --git a/.github/actions/hello-world/entrypoint.sh b/.github/actions/hello-world/entrypoint.sh new file mode 100644 index 0000000..9cdc935 --- /dev/null +++ b/.github/actions/hello-world/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/sh -l + +echo "Hello $1" +time=$(date) +echo ::set-output name=time::$time \ No newline at end of file diff --git a/.github/workflows/docfx.yml b/.github/workflows/docfx.yml new file mode 100644 index 0000000..7b9bf44 --- /dev/null +++ b/.github/workflows/docfx.yml @@ -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 }}" \ No newline at end of file