Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
first commit

updates

Update README and LaTeX build configuration with correct repository name

Update update.yml

update

updates
  • Loading branch information
dariusptrs committed Mar 29, 2024
1 parent 96bb6bd commit 0e302f7
Show file tree
Hide file tree
Showing 40 changed files with 384 additions and 87 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/inhaltlicher_fehler.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Inhaltlicher Fehler
description: Hilf uns Fehler zu Verbessern
title: ''
labels: [bug]
assignees: []

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
container: makeappdev/uselatex:latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetches all history for all branches and tags

- name: Configure Git safe directory with GITHUB_WORKSPACE
run: git config --global --add safe.directory $GITHUB_WORKSPACE
Expand Down
55 changes: 39 additions & 16 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,52 @@
name: Update README and LaTeX Build File

on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
update-files-and-rename-tex:
update-files:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Extract repository name
run: echo "REPO_NAME=$(echo ${{ github.repository }} | sed 's|.*/||')" >> $GITHUB_ENV

- name: Update README
run: |
sed -i "1s/.*/# ${{ env.REPO_NAME }}/" README.md
sed -i "/Actions Status/c\[![Actions Status](https://github.com/${{ github.repository }}/workflows/CI/badge.svg)](https://github.com/${{ github.repository }})" README.md
- name: Update CMakeLists.txt with new LaTeX file name
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Update files with Python
run: |
sed -i "/project(/c\\project(${{ env.REPO_NAME }} NONE)" CMakeLists.txt
sed -i "0,/[^ ]*\.tex/s//${{ env.REPO_NAME }}.tex/" CMakeLists.txt
python -c "\
import os, re
# Extract repository name
repo_name = os.getenv('GITHUB_REPOSITORY').split('/')[-1]
# Update README.md
with open('README.md', 'r+') as file:
lines = file.readlines()
lines[0] = f'# {repo_name}\\n'
for i, line in enumerate(lines):
if 'Actions Status' in line:
lines[i] = f'[![Actions Status](https://github.com/{os.getenv('GITHUB_REPOSITORY')}/workflows/CI/badge.svg)](https://github.com/{os.getenv('GITHUB_REPOSITORY')})\\n'
file.seek(0)
file.writelines(lines)
file.truncate()
# Update CMakeLists.txt with project name
with open('CMakeLists.txt', 'r+') as file:
content = file.read()
content = re.sub(r'project\(([^ ]*)', f'project({repo_name}', content, count=1)
# Assuming the main LaTeX file is the first .tex file mentioned in CMakeLists.txt
content = re.sub(r'([^ ]*\.tex)', f'{repo_name}.tex', content, count=1)
file.seek(0)
file.write(content)
file.truncate()\
"
- name: Setup Git
run: |
Expand All @@ -32,6 +55,6 @@ jobs:
- name: Commit and push if changed
run: |
git add README.md CMakeLists.txt
git add README.md CMakeLists.txt
git diff --staged --quiet || git commit -m "Update README and LaTeX build configuration with correct repository name"
git push
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,4 @@ sympy-plots-for-*.tex/

# xindy
*.xdy
git.id
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.12)

project(CheatsheetTemplate NONE)
project(Computertechnik NONE)
include(UseLATEX)

add_custom_target(
Expand All @@ -12,12 +12,12 @@ add_custom_target(
set(IMAGE_DIRS
img
#Add subdirectories here
#img/logic
#img/rca
img/logic
img/rca
)

add_latex_document(
CheatsheetTemplate.tex
Computertechnik.tex
FORCE_PDF
IMAGE_DIRS ${IMAGE_DIRS}
DEPENDS writegitid
Expand Down
62 changes: 0 additions & 62 deletions CheatsheetTemplate.tex

This file was deleted.

Loading

0 comments on commit 0e302f7

Please sign in to comment.