2020-02-10 12:34:58 +01:00
|
|
|
# Copyright (c) 2016-2020 Martin Donath <martin.donath@squidfunk.com>
|
2019-12-06 15:52:21 +01:00
|
|
|
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to
|
|
|
|
# deal in the Software without restriction, including without limitation the
|
|
|
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
# sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
# IN THE SOFTWARE.
|
|
|
|
|
2019-12-08 17:09:45 +01:00
|
|
|
name: ci
|
2019-12-06 15:52:21 +01:00
|
|
|
on:
|
|
|
|
- push
|
|
|
|
- pull_request
|
|
|
|
|
|
|
|
# Jobs to run
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
# Build theme
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
# Limit clone depth to speed up build
|
2020-03-06 10:31:56 +01:00
|
|
|
- uses: actions/checkout@v2
|
2019-12-06 15:52:21 +01:00
|
|
|
|
|
|
|
# Install Node runtime and dependencies
|
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 10.x
|
|
|
|
|
|
|
|
- uses: actions/cache@v1
|
|
|
|
id: cache-node
|
|
|
|
with:
|
|
|
|
path: node_modules
|
|
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
|
|
|
|
- if: steps.cache-node.outputs.cache-hit != 'true'
|
|
|
|
run: npm install
|
|
|
|
|
|
|
|
# Run linter and build distribution files
|
|
|
|
- run: npm run lint
|
|
|
|
- run: npm run build
|
|
|
|
|
2019-12-25 15:09:36 +01:00
|
|
|
# Check diff after build
|
|
|
|
- run: git diff --name-only
|
|
|
|
|
2019-12-06 15:52:21 +01:00
|
|
|
# Build and deploy documentation site
|
|
|
|
deploy:
|
|
|
|
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
# Limit clone depth to speed up build
|
2020-03-06 10:31:56 +01:00
|
|
|
- uses: actions/checkout@v2
|
2019-12-06 15:52:21 +01:00
|
|
|
|
|
|
|
# Install Python runtime and dependencies
|
|
|
|
- uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: 3.x
|
|
|
|
|
2020-02-15 11:13:22 +01:00
|
|
|
# - uses: actions/cache@v1
|
|
|
|
# id: cache-python
|
|
|
|
# with:
|
|
|
|
# path: ~/.cache/pip
|
|
|
|
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
2019-12-06 15:52:21 +01:00
|
|
|
|
2020-02-15 11:13:22 +01:00
|
|
|
# - if: steps.cache-python.outputs.cache-hit != 'true'
|
|
|
|
- run: pip install -r requirements.txt
|
2019-12-06 15:52:21 +01:00
|
|
|
|
|
|
|
# Set configuration for repository and deploy documentation
|
|
|
|
- env:
|
|
|
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
|
|
GH_NAME: ${{ secrets.GH_NAME }}
|
|
|
|
GH_EMAIL: ${{ secrets.GH_EMAIL }}
|
|
|
|
run: |
|
|
|
|
REMOTE="https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material"
|
|
|
|
git config --global user.name "${GH_NAME}"
|
|
|
|
git config --global user.email "${GH_EMAIL}"
|
|
|
|
git remote set-url origin ${REMOTE}
|
|
|
|
|
2020-02-14 09:31:59 +01:00
|
|
|
# Install theme and dependencies
|
|
|
|
- run: |
|
|
|
|
python setup.py install
|
|
|
|
pip install mkdocs-minify-plugin>=0.2
|
2019-12-06 15:52:21 +01:00
|
|
|
|
|
|
|
# Build documentation
|
2019-12-07 17:23:57 +01:00
|
|
|
- env:
|
|
|
|
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
|
|
|
|
run: |
|
2019-12-06 15:52:21 +01:00
|
|
|
mkdocs gh-deploy --force
|
|
|
|
mkdocs --version
|
|
|
|
|
2020-02-17 17:25:40 +01:00
|
|
|
# Publish Python package and Docker image
|
|
|
|
publish:
|
2020-02-24 23:07:14 +01:00
|
|
|
if: |
|
2020-02-25 11:32:54 +01:00
|
|
|
github.repository == 'squidfunk/mkdocs-material' &&
|
2020-02-24 23:07:14 +01:00
|
|
|
startsWith(github.ref, 'refs/tags')
|
2020-02-17 17:25:40 +01:00
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
# Limit clone depth to speed up build
|
2020-03-06 10:31:56 +01:00
|
|
|
- uses: actions/checkout@v2
|
2020-02-17 17:25:40 +01:00
|
|
|
|
2020-03-06 10:31:56 +01:00
|
|
|
# Install Node runtime and dependencies
|
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 10.x
|
2020-02-17 17:25:40 +01:00
|
|
|
|
2020-03-06 10:31:56 +01:00
|
|
|
- uses: actions/cache@v1
|
|
|
|
id: cache-node
|
2020-02-17 17:25:40 +01:00
|
|
|
with:
|
2020-03-06 10:31:56 +01:00
|
|
|
path: node_modules
|
|
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
|
|
|
|
- if: steps.cache-node.outputs.cache-hit != 'true'
|
|
|
|
run: npm install
|
|
|
|
|
|
|
|
# Build distribution files
|
|
|
|
- run: npm run build
|
2020-02-17 17:25:40 +01:00
|
|
|
|
|
|
|
# Install Python runtime and dependencies
|
|
|
|
- uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: 3.x
|
|
|
|
|
|
|
|
- run: pip install --upgrade setuptools wheel twine
|
|
|
|
|
2020-03-06 10:31:56 +01:00
|
|
|
# # Build and test Docker image
|
|
|
|
# - run: |
|
|
|
|
# docker build -t ${GITHUB_REPOSITORY} .
|
|
|
|
# docker run --rm -i -v $(pwd):/docs ${GITHUB_REPOSITORY} \
|
|
|
|
# build --theme material
|
2020-02-17 17:25:40 +01:00
|
|
|
|
|
|
|
# Build Python package
|
|
|
|
- run: python setup.py build sdist bdist_wheel --universal
|
|
|
|
|
|
|
|
# Push release to PyPI
|
|
|
|
- env:
|
|
|
|
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
|
|
|
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
|
|
|
run: twine upload -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} dist/*
|
|
|
|
|
2020-02-17 17:53:31 +01:00
|
|
|
# # Push image to Docker Hub
|
|
|
|
# - env:
|
|
|
|
# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
# run: |
|
|
|
|
# docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
|
|
|
|
# docker tag ${GITHUB_REPOSITORY} ${GITHUB_REPOSITORY}:${GITHUB_REF##*/}
|
|
|
|
# docker tag ${GITHUB_REPOSITORY} ${GITHUB_REPOSITORY}:latest
|
|
|
|
# docker push ${GITHUB_REPOSITORY}
|