From 3ee6152c2aebe70af626aca4f4ef3cfa95bffc48 Mon Sep 17 00:00:00 2001 From: Mathias Gleitze Date: Wed, 22 May 2024 18:29:02 +0200 Subject: [PATCH] added secrets to .gitignore Add submodule and testing synchronization Testing synchronization Added initial workflow and changed .gitignore Report folder setup Testing report workflow Changes to report workflow Changes to report workflow Changes to workflow file Set working directory Print folder and file locations Getting there... Added a write permission Didn't work... Trying with deploy key Trying with submodules push Trying with github token Trying again with deploy key Trying with image for pushing to submodule Trying with image for pushing to submodule v2 Trying with image for pushing to submodule v2 again... Trying with submodule --update Trying with submodule --update Trial and error... Trial and error... Trial and error... Trial and error... Trial and error... Trial and error... Trial and error... Trial and error... Trial and error... Trial and error... Trial and error... Trial and error... Trial and error... Trial and error... removed test file removed test file Update develop branch Update develop branch Update develop branch Update develop branch Update develop branch Update develop branch Pushing to code repository using ssh... Pushing to code repository using ssh... Create pull request Create pull request Create pull request Create pull request Create pull request Create pull request Create pull request with ssh? Create pull request with ssh? Create pull request with ssh? Create pull request with ssh? Create pull request with ssh? Create pull request with ssh? Create pull request with evans workflow Create pull request with evans workflow Create pull request with evans workflow Create pull request with evans workflow Create pull request with evans workflow Create and push to branch using ssh Create and push to branch using ssh --- .github/workflows/report.yml | 76 ++++++++++++++++++++++++++++++++++++ .gitignore | 2 + .gitmodules | 3 ++ report | 1 + 4 files changed, 82 insertions(+) create mode 100644 .github/workflows/report.yml create mode 100644 .gitmodules create mode 160000 report diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml new file mode 100644 index 0000000..4bacec3 --- /dev/null +++ b/.github/workflows/report.yml @@ -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 "github-actions@github.com" + + git submodule update --remote + + git add build/main.pdf + git commit -m "Update report PDF" + + git remote set-url origin git@github.com: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 "github-actions@github.com" + + 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 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 72c9c66..5ed5669 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ __pycache__/ .vagrant .Python build/ +!report/build/ develop-eggs/ dist/ downloads/ @@ -637,3 +638,4 @@ infrastructure/.terraform/* infrastructure/temp/* infrastructure/.terraform* infrastructure/grafana/ca_cert +infrastructure/secrets diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2662f0a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "report"] + path = report + url = https://github.com/DevopsGroupC/report diff --git a/report b/report new file mode 160000 index 0000000..0885296 --- /dev/null +++ b/report @@ -0,0 +1 @@ +Subproject commit 08852964b184a25200f580dec4293422c87cbfa8