|
1 |
| -name: Generate Datas |
| 1 | +name: GitHub Snake Game |
| 2 | + |
| 3 | + |
2 | 4 |
|
3 | 5 | on:
|
4 |
| - schedule: # execute every 12 hours |
5 |
| - - cron: "* */12 * * *" |
| 6 | + |
| 7 | + # Schedule the workflow to run daily at midnight UTC |
| 8 | + |
| 9 | + schedule: |
| 10 | + |
| 11 | + - cron: "0 0 * * *" |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + # Allow manual triggering of the workflow |
| 16 | + |
6 | 17 | workflow_dispatch:
|
7 | 18 |
|
| 19 | + |
| 20 | + |
| 21 | + # Trigger the workflow on pushes to the main branch |
| 22 | + |
| 23 | + push: |
| 24 | + |
| 25 | + branches: |
| 26 | + |
| 27 | + - main |
| 28 | + |
| 29 | + |
| 30 | + |
8 | 31 | jobs:
|
9 |
| - build: |
10 |
| - name: Jobs to update datas |
| 32 | + |
| 33 | + generate: |
| 34 | + |
11 | 35 | runs-on: ubuntu-latest
|
| 36 | + |
| 37 | + timeout-minutes: 10 |
| 38 | + |
| 39 | + |
| 40 | + |
12 | 41 | steps:
|
13 |
| - # Snake Animation |
14 |
| - - uses: Platane/snk@master |
15 |
| - id: snake-gif |
16 |
| - with: |
17 |
| - github_user_name: {{ThecoderPinar}} |
18 |
| - svg_out_path: dist/github-contribution-grid-snake.svg |
19 | 42 |
|
20 |
| - - uses: crazy-max/ghaction-github-pages@v2.1.3 |
| 43 | + # Step 1: Checkout the repository |
| 44 | + |
| 45 | + - name: Checkout Repository |
| 46 | + |
| 47 | + uses: actions/checkout@v3 |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + # Step 2: Generate the snake animations |
| 52 | + |
| 53 | + - name: Generate GitHub Contributions Snake Animations |
| 54 | + |
| 55 | + uses: Platane/snk@v3 |
| 56 | + |
21 | 57 | with:
|
22 |
| - target_branch: output |
23 |
| - build_dir: dist |
| 58 | + |
| 59 | + # GitHub username to generate the animation for |
| 60 | + |
| 61 | + github_user_name: ${{ github.repository_owner }} |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + # Define the output files and their configurations |
| 66 | + |
| 67 | + outputs: | |
| 68 | +
|
| 69 | + dist/github-snake.svg |
| 70 | +
|
| 71 | + dist/github-snake-dark.svg?palette=github-dark |
| 72 | +
|
| 73 | + dist/ocean.gif?color_snake=orange&color_dots=#bfd6f6,#8dbdff,#64a1f4,#4b91f1,#3c7dd9 |
| 74 | +
|
24 | 75 | env:
|
25 |
| - GITHUB_TOKEN: ${{ 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 }} |
| 76 | + |
| 77 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + # Step 3: Deploy the generated files to the 'output' branch |
| 82 | + |
| 83 | + - name: Deploy to Output Branch |
| 84 | + |
| 85 | + uses: peaceiris/actions-gh-pages@v3 |
| 86 | + |
| 87 | + with: |
| 88 | + |
| 89 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + |
| 91 | + publish_dir: ./dist |
| 92 | + |
| 93 | + publish_branch: output |
| 94 | + |
| 95 | + # Optionally, you can set a custom commit message |
| 96 | + |
| 97 | + commit_message: "Update snake animation [skip ci]" |
0 commit comments