Skip to content

Commit

Permalink
add Bevy Assets to website (#156)
Browse files Browse the repository at this point in the history
add Bevy Assets to website
  • Loading branch information
mockersf authored May 28, 2021
1 parent 4cae128 commit 7f1e165
Show file tree
Hide file tree
Showing 20 changed files with 692 additions and 60 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: "Build Bevy Assets"
run: cd generate-assets && ./generate_assets.sh

- name: "Build website"
uses: shalzz/zola-deploy-action@master
env:
PAGES_BRANCH: gh-pages
BUILD_DIR: .
BUILD_ONLY: true
TOKEN: fake-secret
24 changes: 24 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Deploy

on:
push:
branches: [master]
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: "Build Bevy Assets"
run: cd generate-assets && ./generate_assets.sh

- name: "Build and deploy website"
uses: shalzz/zola-deploy-action@master
env:
PAGES_BRANCH: gh-pages
BUILD_DIR: .
TOKEN: ${{ secrets.CART_PAT }}
39 changes: 0 additions & 39 deletions .github/workflows/main.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
public
**/.DS_Store
.idea/
content/assets
2 changes: 2 additions & 0 deletions generate-assets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
assets
149 changes: 149 additions & 0 deletions generate-assets/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions generate-assets/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "generate-assets"
version = "0.1.0"
authors = [
"Bevy Contributors <bevyengine@gmail.com>",
"Carter Anderson <mcanders1@gmail.com>",
]
license = "MIT"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
toml = "0.5"
serde = { version = "1", features = [ "derive" ] }
rand = "0.8"
5 changes: 5 additions & 0 deletions generate-assets/generate_assets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

git clone --branch bevy-asset https://github.com/bevyengine/awesome-bevy assets

cargo run -- assets ../content
42 changes: 42 additions & 0 deletions generate-assets/parse_old_readme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import re
import os
import sys

name_fix = {
'bevy_nbody': 'thallada-bevy_nbody',
'bevy-nbody': 'WhoisDavid-bevy-nbody',
}

f = open(sys.argv[1] + "/README.md")
lines = f.readlines()

root_folder = sys.argv[2] + "/"
os.mkdir(root_folder)

category = None
subcategory = None
current_path = root_folder
for line in lines:
if line[0:3] == "## ":
category = line.split("# ")[1][0:-1]
current_path = root_folder + category
os.mkdir(current_path)
elif line[0:3] == "###":
subcategory = line.split("# ")[1][0:-1]
current_path = root_folder + category + "/" + subcategory
os.mkdir(current_path)
elif line[0:2] == "* ":
line = line[0:-1]
m = re.search('\* \[([^]]*)\]\(([^)]*)\)(: (.*))?', line)
name = m.group(1)
link = m.group(2)
desc = m.group(4)
if name in name_fix:
name = name_fix[name]
f = open(current_path + '/' + name.replace(' ', '-').replace('/', '-') + ".toml", "w")
f.write("name = \"" + name + "\"\n")
if desc is not None:
f.write("description = \"" + desc.replace('"', '\'') + "\"\n")
f.write("link = \"" + link + "\"\n")
f.close()

Loading

0 comments on commit 7f1e165

Please sign in to comment.