Update docs.yml #2
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: Deploy documentation | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
update-documentation: | |
runs-on: ubuntu-latest | |
outputs: | |
SHA: ${{ steps.sha.outputs.SHA }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Install Doxygen | |
run: | | |
sudo apt update | |
sudo apt install doxygen graphviz texlive texlive-latex-extra ghostscript -y | |
shell: bash | |
- name: Remove old documentation | |
run: | | |
cd docs | |
touch html documentation.pdf cards | |
rm -r html documentation.pdf cards | |
- name: Run Doxygen | |
run: | | |
cd docs | |
doxygen Doxyfile | |
shell: bash | |
- name: Make PDF | |
run: | | |
cd docs/latex | |
make | |
mv refman.pdf ../documentation.pdf | |
cd .. | |
rm -r latex | |
shell: bash | |
- name: Copy PDF to website | |
run: | | |
cd docs | |
cp documentation.pdf html/ | |
shell: bash | |
- name: Create card archives | |
run: | | |
cd resources/cards | |
zip -r gwent_cards_de de | |
zip -r gwent_cards_en en | |
tar -cf gwent_cards_de.tar.gz de | |
tar -cf gwent_cards_en.tar.gz en | |
shell: bash | |
- name: Move card archives to website | |
run: | | |
mkdir -p docs/html/cards | |
mv resources/cards/gwent_cards_de.zip docs/html/cards | |
mv resources/cards/gwent_cards_en.zip docs/html/cards | |
mv resources/cards/gwent_cards_de.tar.gz docs/html/cards | |
mv resources/cards/gwent_cards_en.tar.gz docs/html/cards | |
cp resources/cards/printing-layout.pdf docs/html/cards | |
shell: bash | |
- name: Push changes | |
uses: actions-x/commit@v6 | |
with: | |
name: github-actions | |
email: action@github.com | |
message: updated API documentation | |
files: docs | |
force: true | |
- name: Get SHA | |
id: sha | |
run: | | |
sha_new=$(git rev-parse HEAD) | |
echo "SHA=$sha_new" >> $GITHUB_OUTPUT | |
echo ${{ steps.sha.outputs.SHA }} | |
- run: echo ${{ steps.sha.outputs.SHA }} | |
deploy: | |
needs: update-documentation | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
sparse-checkout: ./docs/html | |
ref: ${{ needs.update-documentation.outputs.SHA }} | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: './docs/html' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |