Skip to content

subproject-updated #503

subproject-updated

subproject-updated #503

Workflow file for this run

name: build docs
on:
repository_dispatch:
types: ["subproject-updated"]
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container: klakegg/hugo:ext-alpine
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.TZC_RO_ACCESS_TOKEN }}
- name: mark safe
run: |
git config --global --add safe.directory '*'
- name: update submodules
run: |
git submodule update --remote
- name: collect docs
run: |
sh ./tools/inject.sh
- name: cleanup
run: |
rm -rf public/*
rm -rf public/.git
- name: build
run: hugo
- name: cname
run: |
printf docs.tez.capital > public/CNAME
- name: Get current date
id: date
run: |
echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: publish
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.DOCS_BUILDER_KEY }}
GITHUB_SHA: $GITHUB_SHA
with:
source-directory: public/
destination-github-username: tez-capital
destination-repository-name: docs.tez.capital
user-email: docs-builder@tez.capital
commit-message: publish-${{ steps.date.outputs.date }}
- name: Check for changes
id: check_changes
run: |
git diff --exit-code || echo "update_required=true" >> $GITHUB_OUTPUT
continue-on-error: true
- name: commit submodules
if: steps.check_changes.outputs.update_required == 'true'
run: |
git add .
git commit -m "Update submodules"
- name: prepare path
if: steps.check_changes.outputs.update_required == 'true'
run: |
mkdir -p ./tmp/${{ github.repository }}
- name: Checkout wit GITHUB_TOKEN
if: steps.check_changes.outputs.update_required == 'true'
uses: actions/checkout@v3
with:
submodules: false
path: ./tmp/${{ github.repository }}
- name: push changes with GITHUB_TOKEN
if: steps.check_changes.outputs.update_required == 'true'
working-directory: ./tmp/${{ github.repository }}
run: |
git remote add local_mirror $GITHUB_WORKSPACE
git pull local_mirror main
git push origin main