Skip to content

Commit

Permalink
run update workflow from root directory (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
donno2048 committed Nov 20, 2023
1 parent 288a767 commit 11e48f4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ jobs:
- uses: actions/checkout@v3
- run: |
sudo apt install qrencode nasm python3 -y
nasm snake.asm -o docs/snake.com -f bin
cd docs
xxd -p snake.com > snake.hex
python3 update.py
qrencode -r snake.com -8 -o snake.png
rm ../demo/snake.zip
zip ../demo/snake.zip snake.com
cd ..
nasm snake.asm -o snake.com
xxd -p snake.com | python3 docs/update.py
qrencode -r snake.com -8 -o docs/snake.png
zip demo/snake.zip snake.com
git config --global user.email "just4now666666@gmail.com"
git config --global user.name "donno2048"
git add .
Expand Down
Binary file modified demo/snake.zip
Binary file not shown.
2 changes: 0 additions & 2 deletions docs/.gitignore

This file was deleted.

5 changes: 3 additions & 2 deletions docs/update.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from pathlib import Path
from re import findall

hexdata = open("snake.hex").read().replace("\n", "")
hexdata = open(0).read().replace("\n", "")

length = len(hexdata)

for div in range(int(length ** .5), 0, -1):
if not length % div:
break

open("../README.md", "w").write(open('template.md').read().format(size = length // 2, hex = "\n".join(findall('.' * (length // div), hexdata))))
open("README.md", "w").write(open(Path(__file__).parent.resolve() / 'template.md').read().format(size = length // 2, hex = "\n".join(findall('.' * (length // div), hexdata))))

0 comments on commit 11e48f4

Please sign in to comment.