Skip to content

Commit

Permalink
Merge pull request #179 from DevopsGroupC/feature/178-automate-report…
Browse files Browse the repository at this point in the history
…-building

*** Squashed 66 commits of trial and error ***
  • Loading branch information
Mathias-Gleitze authored May 22, 2024
2 parents 6a65385 + 3ee6152 commit a4ed742
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build Report

on:
workflow_dispatch:

permissions:
contents: write

jobs:
build_latex:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
ssh-key: ${{ secrets.DEPLOY_KEY_FOR_REPORT_PRIVATE }}

- name: Update submodules
run: |
git submodule update --init --recursive --remote
- name: Set up LaTeX
uses: xu-cheng/latex-action@v3
with:
working_directory: report
root_file: main.tex

- name: Move main.pdf
run: |
cd report
mv -f main.pdf ./build
- name: Setup SSH for pushing to report repository
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY_FOR_REPORT_PRIVATE }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Commit and push main.pdf
run: |
cd report
git config user.name "github-actions"
git config user.email "[email protected]"
git submodule update --remote
git add build/main.pdf
git commit -m "Update report PDF"
git remote set-url origin [email protected]:DevopsGroupC/report.git
GIT_SSH_COMMAND='ssh -i ~/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push -f origin main
- name: Setup SSH for pushing to main repository
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY_FOR_MINITWIT_PRIVATE }}" > ~/.ssh/id_minitwit_rsa
chmod 600 ~/.ssh/id_minitwit_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Update submodule reference and push
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git fetch origin
git reset --hard origin/develop
git submodule update --remote
git checkout -b update-report-pdf
git add report
git commit -m "Update submodule reference to latest commit"
GIT_SSH_COMMAND='ssh -i ~/.ssh/id_minitwit_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push -f --set-upstream origin update-report-pdf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ __pycache__/
.vagrant
.Python
build/
!report/build/
develop-eggs/
dist/
downloads/
Expand Down Expand Up @@ -637,3 +638,4 @@ infrastructure/.terraform/*
infrastructure/temp/*
infrastructure/.terraform*
infrastructure/grafana/ca_cert
infrastructure/secrets
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "report"]
path = report
url = https://github.com/DevopsGroupC/report
1 change: 1 addition & 0 deletions report
Submodule report added at 088529

0 comments on commit a4ed742

Please sign in to comment.