Files
flameshot/.github/workflows/deploy-dev-docs.yml
Haris Gušić a2f036be9b Add developer docs (#3097)
* Create developer docs

* Remove mike dependency

* Update docs

* Make docs/dev self-contained

* Add incomplete deploy-dev-docs workflow

* Fix typo

* Add workflow file to path:

* Add doxygen as dependency

* Add remaining deploy steps

* Add working-directory

* Fix working-directory error

* Add missing Makefile

* Change flameshot website repo url

* Change working-directory for safety step

* Add git credentials

* Change push credentials

* Use different token secret

* Remove checkpoints

* Add separate branch developer-docs

* Add || true

* Update docs

* Update the 'Maintaining the documentation' docs

* Fix error in deploy-dev-docs workflow

* Remove accidentally committed file DOC.md

* Update PAT expiry date

* Rename developer-docs branch to dev-docs-staging
2023-08-21 20:06:39 +02:00

76 lines
2.6 KiB
YAML

name: Deploy developer docs
on:
push:
branches: [ master, docs ]
paths:
- 'src/**'
- 'docs/dev/**'
- '.github/workflows/deploy-dev-docs.yml'
jobs:
build-and-deploy:
runs-on: ubuntu-22.04
steps:
- name: Install dependencies
run: |
sudo apt-get --yes --quiet update
sudo apt-get --yes --no-install-recommends install doxygen
pip install \
mkdocs \
mkdocs-material \
git+https://github.com/veracioux/mkdoxy@v1.0.0
- name: Checkout flameshot source
uses: actions/checkout@v3
with:
path: 'flameshot'
- name: Build docs
working-directory: ${{github.workspace}}/flameshot/docs/dev
run: |
make build
- name: Checkout flameshot website
uses: actions/checkout@v3
with:
repository: 'flameshot-org/flameshot-org.github.io'
ref: 'gh-pages'
path: 'website'
- name: Configure git credentials for website repo
working-directory: ${{github.workspace}}/website
run: |
git config user.name "GitHub Actions"
git config user.email "github-actions-bot@users.noreply.github.com"
git config http.https://github.com/.extraheader 'AUTHORIZATION basic ${{secrets.TOKEN_PUSH_TO_WEBSITE_REPO}}'
git remote add destination "https://x-access-token:${{secrets.TOKEN_PUSH_TO_WEBSITE_REPO}}@github.com/flameshot-org/flameshot-org.github.io"
- name: Add developer docs to website deployment
working-directory: ${{github.workspace}}/website
run: |
# Create empty dev-docs-staging branch
git checkout --orphan dev-docs-staging
git rm -r --cached .
rm -rf docs/dev
# Copy generated docs over
mkdir -p docs
mv "${{github.workspace}}/flameshot/docs/dev/output" \
"./docs/dev"
# Commit docs/dev to the dev-docs-staging branch
git add docs/dev
HASH="$(git --git-dir="${{github.workspace}}/flameshot/.git" rev-parse HEAD)"
git commit --message "Add developer docs from flameshot@$HASH"
# Apply changes to gh-pages
git checkout --force gh-pages
git checkout dev-docs-staging -- docs/dev
# Commit (we use `|| true` because the commit could be empty and thus fail)
git commit --message "Add developer docs from flameshot@$HASH" || true
- name: Push to website repo
working-directory: ${{github.workspace}}/website
run: |
git push --force destination dev-docs-staging
git push destination gh-pages