Skip to content

Commit

Permalink
add github workflows, documentation site
Browse files Browse the repository at this point in the history
  • Loading branch information
KTrain5169 committed Oct 19, 2024
1 parent d7c924f commit 652587d
Show file tree
Hide file tree
Showing 11 changed files with 321 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @KTrain5169
37 changes: 37 additions & 0 deletions .github/workflows/mkdocs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build docs site

on:
push:
paths:
- "docs/**"
- "mkdocs.yml"
pull_request:
paths:
- "docs/**"
- "mkdocs.yml"
workflow_dispatch:

jobs:
build-docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install dependencies
run: pip install -r requirements.txt

- name: MkDocs
run: mkdocs build

- name: Upload build
uses: actions/upload-artifact@v4
with:
name: Completed mkdocs build - ${{ github.sha }}
path: site/
23 changes: 23 additions & 0 deletions .github/workflows/mkdocs-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy docs site

on:
workflow_dispatch:

jobs:
build-docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install dependencies
run: pip install -r requirements.txt

- name: MkDocs
run: mkdocs gh-deploy
47 changes: 47 additions & 0 deletions .github/workflows/script-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Python app

on:
push:
paths:
- 'script.py'
pull_request:
paths:
- 'script.py'
workflow_dispatch:

jobs:
build:
name: Build app on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["windows-latest", "macos-latest", "ubuntu-latest"]
steps:
- name: Checkout ref
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install requirements
run: |
pip install -r requirements.txt
- name: PyInstaller
run: pyinstaller script.py --name CatPack_Crafter_${{ github.sha }}_${{ matrix.os }}

- name: Upload Builds
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }} build
path: build/

- name: Upload Dists
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }} dist
path: dist/
88 changes: 88 additions & 0 deletions .github/workflows/script-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Release Python app

run-name: Release ${{ github.ref_name }}

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
build:
name: Build app for ${{ matrix.os }}
runs-on: ${{ matrix.runner_os }}
strategy:
matrix:
runner_os: ["windows-latest", "macos-latest", "ubuntu-latest"]
includes:
- runner_os: "windows-latest"
os: "Windows"
- runner_os: "macos-latest"
os: "Mac"
- runner_os: "ubuntu-latest"
os: "Linux"
steps:
- name: Checkout ref
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install requirements
run: |
pip install -r requirements.txt
- name: PyInstaller
run: pyinstaller --onefile --windowed script.py --name CatPack_Crafter_${{ github.ref_name }}_${{ matrix.os }}

- name: List dist directory
run: ls -R dist

- name: Tar files on Linux
if: ${{ matrix.runner_os == 'ubuntu-latest' }}
run: |
chmod +x dist/CatPack_Crafter_${{ github.ref_name }}_${{ matrix.os }}
tar -czvf dist/CatPack_Crafter_${{ github.ref_name }}_${{ matrix.os }}.tar.gz dist/CatPack_Crafter_${{ github.ref_name }}_${{ matrix.os }}
rm -rf dist/CatPack_Crafter_${{ github.ref_name }}_${{ matrix.os }}
- name: Upload debug builds
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}_builds
path: build/*

- name: Upload distributable builds
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}_dists
path: dist/*

normal_release:
name: Draft normal release
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
pattern: "*_dists"

- name: List release-artifacts directory # debug
run: ls -R release-artifacts

- name: Draft normal release
uses: ncipollo/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
tag: ${{ github.ref_name }}
artifacts:
draft: true
name: "CatPack_Crafter_${{ github.ref_name }}_*"
body: "Need help? Refer to the documentation site."
17 changes: 17 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contributing

Want to help? Great! To get started, follow these steps. This guide assumes you know how to use Git on a basic level.

- [Fork this repository](https://github.com/KTrain5169/CatPackMaker/fork) and clone your fork.
- Create a virtual environment using `python -m venv venv`, then run `venv\scripts\activate` to activate it.
- Install all dependencies using `pip install -r requirements.txt`.
- Make your changes, then test your changes to see if they will work.
- Commit your changes and push it, then create a Pull Request.
- Your PR will be reviewed and will either have changes requested or approved and merged.

We recommend the following when contributing:

- Using VS Code (or a fork of it)? You should see recommendations regarding extensions to use. We recommend installing them.
- We also recommend installing `autopep8` via `pip install autopep8` to ensure you follow styling.
- Before committing your changes and pushing them it may be a good idea to build and then test them. This isn't strictly necessary, but can be helpful.
- Be helpful in your commit names.
15 changes: 15 additions & 0 deletions docs/downloads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Downloads

The following page lists releases of this software.

- [Latest release on GitHub](https://github.com/KTrain5169/CatPackMaker/releases/latest)
- [⚠️Unstable builds on GitHub⚠️](https://github.com/KTrain5169/CatPackMaker/actions) - please be aware that this is beta software and stuff can break if you are using these versions. You will receive limited support if you are using these builds.
- [Running the script from source](./run-from-source.md) - same as above in that this is considered "beta" software.

???+ note "Historical versions"

This is here for archival purposes. When new versions are released, it may take a little bit before this table is updated.

| Version | Changelog link | Direct download link |
|---------|----------------|----------------------|
| v1.0.0 | TBA | TBA |
12 changes: 12 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Advanced CatPack crafter

This program simplifies creating an advanced Prism Launcher CatPack.

This site hosts documentation on how to use this program. You can navigate using the sidebar.

Other useful links:

- [Prism Launcher Community CatPacks (Discord)](https://discord.com/channels/1031648380885147709/1278732669525561486)
- [Issue tracker](https://github.com/KTrain5169/CatPackMaker/issues)
- [Discord server](https://discord.gg/G6YvWhctjk) (Ask for support in there!)
- [Pull requests](https://github.com/KTrain5169/CatPackMaker/pulls)
37 changes: 37 additions & 0 deletions docs/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# How to use

Using the app should be fairly simple, so hopefully this will be a walk in the park.

## 1. Locate your images

It's a good idea to consolidate the images you will be using in a singular folder, or *at least* remember the path to get to them. Otherwise, you'll have take very long time trying to find the images you want.

## 2. Using the app

Assuming you have already [downloaded the program](./downloads.md), run it and you'll be presented with a couple of options.

- `CatPack Name`: THe name of the CatPack, both in the JSON and the folder name. Be careful - if a folder with that name already exists and has a CatPack setup in it, the new JSON file will overwrite it.
- `Select Output Folder`: Where the CatPack's folder will be located in.
- `Select Default Image (Optional)`: Allows you to select an image that will be set as a "default", which means it wll show if no other image can be shown. The default image will be previewed at a smaller size beneath the options.
- `Add Images`: Adds images to your CatPack. Each image will ask you for a Start and End date/month. Be cautious: the program does not have sanity checks for the calendar dates, so be sure not to accidentally input the 31st of Febuary (or something of that vein)!
- `Confirm`: Creates the CatPack using the above options.

## Using the CatPack

Once your CatPack is created, you can move the folder with all the CatPack stuff into your Prism installation's `catpacks` folder.
This should be located at `../PrismLauncher/catpacks`, where `..` varies depending on the form of Prism you are using:

???+ note "What would .. mean in my case?"

If you are using a portable build of Prism, .. represents the directory where your portable build resides.

If you are using a fully installed build of Prism, .. is represented differently depending on OS:

- Windows: `%appdata%`
- macOS: `~/Library/Application Support`
- Linux: `~/.local/share`

However, if you use either of the following package managers, they will instead be located at:

- Scoop: `%HOMEPATH%/scoop/persist` - Note that the directory may be seen as `prismlauncher` instead of `PrismLauncher`. This is as intended.
- Flatpak: `~/.var/app/org.prismlauncher.PrismLauncher/data`
31 changes: 31 additions & 0 deletions docs/run-from-source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Run from source

This page details how to run the program from source. If you have no idea what this page is saying, you *probably* shouldn't follow it.

## Setup

In order to build, you'll need the following as prerequisites:

- A working Python installation that supports the code. The version used for developing this program originally was Python 3.11 from the [official Python website](https://python.org).
- Required dependencies installed. They are marked in the `requirements.txt` file for your convenience.
- While not required, it is *highly recommended* to use a virtual environment. You can create one using `python -m venv venv`, then using `venv\scripts\activate`.

## Running the app

Once you have the "App" category of dependencies installed, you can simply run `python script.py`.

## Compiling from source

After installing dependencies in both the "App" and "Compiling" categories, you can run `pyinstaller script.py` to compile.
Some additional arguments you might want to use are:

- `--onefile`: Builds into a singular executable file.
- `--name <name>`: Sets the executable output's name.
- `--windowed`: Prevents CMD from coming up when you launch the executable.

## Building the documentation site

You only need to install the dependencies listed in the "Documentation" category.
After that, you can simply run `mkdocs build`, which will output a `site/` folder that contains the fully built site.

Do NOT attempt to run `mkdocs gh-deploy`, as it will create a new branch and (attempt to) push it to the remote.
13 changes: 13 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
site_name: CatPack Crafter docs
repo_name: GitHub source
repo_url: https://github.com/KTrain5169/CatPackMaker
edit_uri: blob/main/docs/
site_description: Documentation for the CatPack Crafter.
site_author: KTrain5369
theme:
name: material
nav:
- Home: index.md
- Download: downloads.md
- How to use: instructions.md
- Contributing: contributing.md

0 comments on commit 652587d

Please sign in to comment.