From 13a7a6235d0b4079cc21ebe4ebe0835ec42a662b Mon Sep 17 00:00:00 2001 From: Naseer Dari Date: Wed, 28 Feb 2024 15:51:35 -0600 Subject: [PATCH 1/7] Enhance PDF generation (#2) - Add sorting to the folders - Fix the regex to add files with uppercase letters in their names --- ...io-implement-authentication-and-authorization-solutions.md | 2 +- security-plus-all.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/3.0-implementation/3.8-given-a-scenario-implement-authentication-and-authorization-solutions.md b/3.0-implementation/3.8-given-a-scenario-implement-authentication-and-authorization-solutions.md index d3eaac0..3e4c37b 100644 --- a/3.0-implementation/3.8-given-a-scenario-implement-authentication-and-authorization-solutions.md +++ b/3.0-implementation/3.8-given-a-scenario-implement-authentication-and-authorization-solutions.md @@ -1,4 +1,4 @@ -# 3.8 +# 3.8 Given a scenario implement authentication and authorization solutions ## Authentication management diff --git a/security-plus-all.py b/security-plus-all.py index 10a0c95..7e9683d 100755 --- a/security-plus-all.py +++ b/security-plus-all.py @@ -14,9 +14,10 @@ def generate_security_plus_file(): with open(markdown_file, "w") as f: f.write("# **CompTIA Security+ (SY0-601)**\n\n") folders = [f for f in os.listdir() if os.path.isdir(f) and re.match(r"\d\.\d-[a-z-]+", f)] + folders = sorted(folders) for folder in folders: folder_path = os.path.join(os.getcwd(), folder) - files = [f for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f)) and re.match(r"\d+\.\d+-[a-z-]+\.md", f)] + files = [f for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f)) and re.match(r"\d+\.\d+-[a-zA-Z-]+\.md", f)] files = sorted(files) if files: folder_title = "-".join(folder.split("-")[1:]).replace("-", " ").title() @@ -24,6 +25,7 @@ def generate_security_plus_file(): for file in files: with open(os.path.join(folder_path, file), "r") as fp: f.write(fp.read() + "\n") + f.write("\n") if __name__ == "__main__": generate_security_plus_file() From 89c25fee2949e153d78872f5a26002776142edaa Mon Sep 17 00:00:00 2001 From: fjavierm Date: Fri, 26 Apr 2024 19:57:31 +0100 Subject: [PATCH 2/7] Adds a GitHub action to rlease the PDF (#3) --- .github/workflows/release-pdf-action.yaml | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/release-pdf-action.yaml diff --git a/.github/workflows/release-pdf-action.yaml b/.github/workflows/release-pdf-action.yaml new file mode 100644 index 0000000..ba8a314 --- /dev/null +++ b/.github/workflows/release-pdf-action.yaml @@ -0,0 +1,40 @@ +name: Generate PDF Release + +on: + push: + tags: + - '*' + +jobs: + generate-pdf-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Generate PDF + run: python security-plus-all.py + + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: | + Automated release generated from markdown files. + draft: false + prerelease: false + files: | + security-plus-sy0-601-all.pdf From 488d8d118aabca9352cdaec882c53fccae991366 Mon Sep 17 00:00:00 2001 From: fjavierm Date: Fri, 26 Apr 2024 20:03:24 +0100 Subject: [PATCH 3/7] Allows manual triggering of the GitHub action (#4) --- .github/workflows/release-pdf-action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-pdf-action.yaml b/.github/workflows/release-pdf-action.yaml index ba8a314..4dedc43 100644 --- a/.github/workflows/release-pdf-action.yaml +++ b/.github/workflows/release-pdf-action.yaml @@ -4,6 +4,7 @@ on: push: tags: - '*' + workflow_dispatch: jobs: generate-pdf-release: From bd0109b45b5b1603c2d155a93ffd3a3122d53fba Mon Sep 17 00:00:00 2001 From: fjavierm Date: Fri, 26 Apr 2024 20:05:38 +0100 Subject: [PATCH 4/7] Removes the requirements step as there is not file (#5) --- .github/workflows/release-pdf-action.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release-pdf-action.yaml b/.github/workflows/release-pdf-action.yaml index 4dedc43..c930557 100644 --- a/.github/workflows/release-pdf-action.yaml +++ b/.github/workflows/release-pdf-action.yaml @@ -18,9 +18,6 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.12' - - - name: Install dependencies - run: pip install -r requirements.txt - name: Generate PDF run: python security-plus-all.py From 1ef108ce7cba4f15890112be26b22e290be56868 Mon Sep 17 00:00:00 2001 From: fjavierm Date: Fri, 26 Apr 2024 20:10:58 +0100 Subject: [PATCH 5/7] Creates the tag differently (#6) --- .github/workflows/release-pdf-action.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-pdf-action.yaml b/.github/workflows/release-pdf-action.yaml index c930557..bf11847 100644 --- a/.github/workflows/release-pdf-action.yaml +++ b/.github/workflows/release-pdf-action.yaml @@ -4,7 +4,7 @@ on: push: tags: - '*' - workflow_dispatch: + workflow_dispatch: # Allow manual triggering jobs: generate-pdf-release: @@ -18,6 +18,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.12' + + - name: Install dependencies + run: pip install -r requirements.txt - name: Generate PDF run: python security-plus-all.py @@ -28,8 +31,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} + tag_name: ${{ github.event.ref }} + release_name: Release ${{ github.event.ref }} body: | Automated release generated from markdown files. draft: false From 3d3a16a91cf77a509757f965f1782c826ce17bec Mon Sep 17 00:00:00 2001 From: fjavierm Date: Fri, 26 Apr 2024 20:13:36 +0100 Subject: [PATCH 6/7] Reset the action code (#7) --- .github/workflows/release-pdf-action.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release-pdf-action.yaml b/.github/workflows/release-pdf-action.yaml index bf11847..027efb0 100644 --- a/.github/workflows/release-pdf-action.yaml +++ b/.github/workflows/release-pdf-action.yaml @@ -18,9 +18,6 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.12' - - - name: Install dependencies - run: pip install -r requirements.txt - name: Generate PDF run: python security-plus-all.py From 4ab108929604e5b86dd153e9bcb79401d6860b65 Mon Sep 17 00:00:00 2001 From: fjavierm Date: Fri, 26 Apr 2024 20:17:21 +0100 Subject: [PATCH 7/7] Changes tag prefix to v (#8) --- .github/workflows/release-pdf-action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-pdf-action.yaml b/.github/workflows/release-pdf-action.yaml index 027efb0..f925227 100644 --- a/.github/workflows/release-pdf-action.yaml +++ b/.github/workflows/release-pdf-action.yaml @@ -3,7 +3,7 @@ name: Generate PDF Release on: push: tags: - - '*' + - 'v*' workflow_dispatch: # Allow manual triggering jobs: