Skip to content

Commit

Permalink
Migrate release of docs from travis-ci to github actions (kubernetes#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf authored Feb 24, 2020
1 parent ceb721d commit 4a63609
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 236 deletions.
8 changes: 8 additions & 0 deletions .github/actions/mkdocs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM squidfunk/mkdocs-material:4.6.3

COPY action.sh /action.sh

RUN apk add --no-cache bash \
&& chmod +x /action.sh

ENTRYPOINT ["/action.sh"]
53 changes: 53 additions & 0 deletions .github/actions/mkdocs/action.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

REQUIREMENTS="${GITHUB_WORKSPACE}/requirements.txt"

if [ -f "${REQUIREMENTS}" ]; then
pip install -r "${REQUIREMENTS}"
fi

if [ -n "${GITHUB_TOKEN}" ]; then
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
elif [ -n "${PERSONAL_TOKEN}" ]; then
remote_repo="https://x-access-token:${PERSONAL_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
fi

git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"

mkdocs build --config-file "${GITHUB_WORKSPACE}/mkdocs.yml"

git clone --branch=gh-pages --depth=1 "${remote_repo}" gh-pages
cd gh-pages

# TODO: enable before release of helm chart
# copy current index file index.yaml before any change
#temp_worktree=$(mktemp -d)
#cp --force "index.yaml" "$temp_worktree/index.yaml"
# remove current content in branch gh-pages
git rm -r .
# copy new doc.
cp -r ../site/* .
# restore chart index
# TODO: enable before release of helm chart
#cp "$temp_worktree/index.yaml" .
# commit changes
git add .
git commit -m "Deploy GitHub Pages"
git push --force --quiet "${remote_repo}" gh-pages > /dev/null 2>&1
9 changes: 9 additions & 0 deletions .github/actions/mkdocs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# action.yml
name: 'Deploy MkDocs'
description: 'Deploys MkDocs site'
branding:
icon: 'arrow-up-circle'
color: 'orange'
runs:
using: 'docker'
image: 'Dockerfile'
23 changes: 23 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: docs and Helm chart

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v1

#- name: Run chart-releaser
# uses: helm/[email protected]
# env:
# CR_TOKEN: "${{ secrets.PERSONAL_TOKEN }}"

- name: Deploy docs
uses: ./.github/actions/mkdocs
env:
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

90 changes: 0 additions & 90 deletions .travis/common.sh

This file was deleted.

45 changes: 0 additions & 45 deletions .travis/publish-docs.sh

This file was deleted.

67 changes: 0 additions & 67 deletions .travis/release-from-travis.sh

This file was deleted.

0 comments on commit 4a63609

Please sign in to comment.