Initialize modern 3D profile README on Gitea
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
name: Generate Snake Animation
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 */12 * * *" # every 12 hours
|
||||
workflow_dispatch: # allows manual run from the Actions tab
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Generate snake SVGs
|
||||
uses: Platane/snk/svg-only@v3
|
||||
with:
|
||||
github_user_name: ${{ github.repository_owner }}
|
||||
outputs: |
|
||||
dist/github-snake.svg
|
||||
dist/github-snake-dark.svg?palette=github-dark
|
||||
|
||||
- name: Constrain snake inside contribution grid
|
||||
run: |
|
||||
python3 -c '
|
||||
import re, glob
|
||||
for path in glob.glob("dist/github-snake*.svg"):
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
c = f.read()
|
||||
c = re.sub(r"viewBox=\"-16 -32 880 192\" width=\"880\" height=\"192\"", "viewBox=\"-8 -8 864 128\" width=\"864\" height=\"128\"", c)
|
||||
def repl(m):
|
||||
x = max(0, min(832, int(m.group(1))))
|
||||
y = max(0, min(96, int(m.group(2))))
|
||||
return f"translate({x}px,{y}px)"
|
||||
c = re.sub(r"translate\((-?\d+)px,(-?\d+)px\)", repl, c)
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
f.write(c)
|
||||
'
|
||||
|
||||
- name: Generate activity graph
|
||||
uses: maurodesouza/github-readme-activity-graph-action@v1
|
||||
with:
|
||||
username: ${{ github.repository_owner }}
|
||||
options: theme=tokyo-night&hide_border=true&area=true
|
||||
output_path: dist/activity-graph.svg
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Push SVGs to the output branch
|
||||
uses: crazy-max/[email protected]
|
||||
with:
|
||||
target_branch: output
|
||||
build_dir: dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user