docker-ce: add convenience script approach #332
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
pip3 install -r requirements.txt | |
- name: Clone deploy branch | |
run: | | |
REMOTE_BRANCH="${REMOTE_BRANCH:-gh-pages}" | |
REMOTE_REPO="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" | |
rm -rf build/html/ | |
mkdir -p build/html/ | |
git clone --depth=1 --branch="${REMOTE_BRANCH}" --single-branch --no-checkout \ | |
"${REMOTE_REPO}" build/html/ | |
- name: Build documentation | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: make html | |
- name: Deploy to GitHub Pages | |
if: "github.event_name == 'push'" | |
run: | | |
SOURCE_COMMIT="$(git log -1 --pretty="%an: %B" "$GITHUB_SHA")" | |
pushd build/html/ &>/dev/null | |
: > .nojekyll | |
git add --all | |
if [ "$(git status --porcelain | wc -l)" -eq 0 ]; then | |
exit 0 | |
fi | |
git -c user.name="GitHub" -c user.email="[email protected]" \ | |
commit --quiet \ | |
--message "Deploy docs from ${GITHUB_SHA}" \ | |
--message "$SOURCE_COMMIT" | |
git push | |
popd &>/dev/null |