Skip to content

Commit 59dcf77

Browse files
authored
refactor example site publish workflow (#172)
* try using environment in actions workflow * refactor wip * refactor * get path from actions var
1 parent 708f230 commit 59dcf77

File tree

2 files changed

+30
-71
lines changed

2 files changed

+30
-71
lines changed

.github/workflows/pages-deploy-example-site.yml

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,44 @@ on:
77
description: 'Docs tag to deploy'
88
required: true
99
type: string
10+
default: main
1011
mkdocs-terminal-version:
1112
description: 'with mkdocs-terminal version'
1213
required: false
1314
type: string
14-
example-site-name:
15-
description: 'name of site in ./tests/examples/'
15+
environment-name:
16+
description: 'Name of the environment to deploy'
1617
required: true
1718
type: choice
1819
options:
1920
- highlightjs
2021
- highlightjs-dark
2122

2223
jobs:
23-
deploy-highlightjs-example:
24-
name: Deploy ${{ inputs.example-site-name }}
25-
if: inputs.example-site-name == 'highlightjs'
26-
uses: ntno/mkdocs-terminal/.github/workflows/reusable-pages-deploy.yml@main
27-
with:
28-
tag: ${{ inputs.tag }}
29-
mkdocs-terminal-version: ${{ inputs.mkdocs-terminal-version }}
30-
example-site-name: 'highlightjs'
31-
secrets:
32-
GH_DEPLOY_KEY: ${{ secrets.DEPLOY_KEY_HIGHLIGHTJS }}
33-
34-
deploy-highlightjs-dark-example:
35-
name: Deploy ${{ inputs.example-site-name }}
36-
if: inputs.example-site-name == 'highlightjs-dark'
37-
uses: ntno/mkdocs-terminal/.github/workflows/reusable-pages-deploy.yml@main
38-
with:
39-
tag: ${{ inputs.tag }}
40-
mkdocs-terminal-version: ${{ inputs.mkdocs-terminal-version }}
41-
example-site-name: 'highlightjs-dark'
42-
secrets:
43-
GH_DEPLOY_KEY: ${{ secrets.DEPLOY_KEY_HIGHLIGHTJS_DARK }}
24+
deploy-example-site:
25+
name: Deploy ${{ inputs.environment-name }}
26+
environment: ${{ inputs.environment-name }}
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
ref: ${{ inputs.tag }}
33+
- name: Install Explicitly Set mkdocs-terminal Version
34+
run: |
35+
if [[ "${{ inputs.mkdocs-terminal-version }}" == "" ]]; then
36+
echo "no mkdocs-version override specified..."
37+
else
38+
pip install mkdocs-terminal==${{ inputs.mkdocs-terminal-version }}
39+
fi
40+
- name: Build MkDocs
41+
run: |
42+
cd tests/examples
43+
make build site="${{ vars.EXAMPLE_NAME }}"
44+
cd -
45+
- name: Deploy to GitHub Pages
46+
uses: peaceiris/actions-gh-pages@v4
47+
with:
48+
deploy_key: ${{ secrets.DEPLOY_KEY }}
49+
external_repository: ${{ vars.GH_REPOSITORY_OWNER }}/${{ vars.GH_REPOSITORY_NAME }}
50+
publish_dir: ./tests/examples/${{ vars.EXAMPLE_NAME }}/site

.github/workflows/reusable-pages-deploy.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)