Skip to content

Commit

Permalink
README の追加
Browse files Browse the repository at this point in the history
  • Loading branch information
nrysk committed Nov 8, 2024
1 parent 7281909 commit 5bc9d3d
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
github_username: ${{ github.repository_owner }}
github_token: ${{ secrets.GITHUB_TOKEN }}
output_path: output/output.png
command: "themefile"
argument: ${{ github.workspace}}/config.toml
command: "theme"
argument: "github"

- name: Push output image to output branch
uses: crazy-max/ghaction-github-pages@v4
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.png
.env
__pycache__
*.blend1
*.blend1
!img/*.png
133 changes: 133 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# cgrass (Contribution to Grass)

## Getting Started

### GitHub Actions
Copy the following code to your `.github/workflows/cgrass.yml` file in your profile repository.

```yaml
name: Generate Picture and Push to output branch

on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *' # any time you want

permissions:
contents: write

jobs:
generate:
runs-on: ubuntu-24.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Generate Picture
uses: nrysk/cgrass@main
with:
github_username: ${{ github.repository_owner }}
github_token: ${{ secrets.GITHUB_TOKEN }}
output_path: output/output.png
command: "theme"
argument: "github"

- name: Push output image to output branch
uses: crazy-max/ghaction-github-pages@v4
with:
target_branch: output
build_dir: output
commit_message: "Generate Output Image"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
You can use the following code to display the generated image.
```
![Contribution to Grass](https://raw.githubusercontent.com/<username>/<username>/refs/heads/output/output.png)
```

## Themes
### github theme
![github theme](img/github.png)

```yaml
- name: Generate Picture
uses: nrysk/cgrass@main
with:
github_username: ${{ github.repository_owner }}
github_token: ${{ secrets.GITHUB_TOKEN }}
output_path: output/output.png
command: "theme"
argument: "github" # change here
```
### github-nograss theme
![github-nograss theme](img/github-nograss.png)
```yaml
- name: Generate Picture
uses: nrysk/cgrass@main
with:
github_username: ${{ github.repository_owner }}
github_token: ${{ secrets.GITHUB_TOKEN }}
output_path: output/output.png
command: "theme"
argument: "github-nograss" # change here
```
### planet theme
![planet theme](img/planet.png)
```yaml
- name: Generate Picture
uses: nrysk/cgrass@main
with:
github_username: ${{ github.repository_owner }}
github_token: ${{ secrets.GITHUB_TOKEN }}
output_path: output/output.png
command: "theme"
argument: "planet" # change here
```
### planet-nograss theme
![planet-nograss theme](img/planet-nograss.png)
```yaml
- name: Generate Picture
uses: nrysk/cgrass@main
with:
github_username: ${{ github.repository_owner }}
github_token: ${{ secrets.GITHUB_TOKEN }}
output_path: output/output.png
command: "theme"
argument: "planet-nograss" # change here
```
## Make your own theme
### 1. Create a new configuration file
Create a new configuration file in your repository. For example, create a file named `mytheme.toml` in the root of your repository.

Configuration file example: [config.toml](config.toml)

### 2. Link the configuration file
Link the configuration file in your workflow file.

```yaml
- name: Generate Picture
uses: nrysk/cgrass@main
with:
github_username: ${{ github.repository_owner }}
github_token: ${{ secrets.GITHUB_TOKEN }}
output_path: output/output.png
command: "themefile" # change here
argument: ${{ github.workspace }}/mytheme.toml # change here
```

### 3. Now you can change the configuration file as you like


Binary file added img/github-nograss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/planet-nograss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/planet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion config.toml → mytheme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ energy = 3.0
rotation = [45, 0, -45]

[render]
samples = 32
samples = 64

0 comments on commit 5bc9d3d

Please sign in to comment.