From 5d8f3afd4ec456e470fafacaf2b2212ddee0f24a Mon Sep 17 00:00:00 2001 From: Simon Tushev Date: Mon, 3 Jul 2023 13:56:39 +0400 Subject: [PATCH] Added 'advanced example' --- README.md | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/README.md b/README.md index fc84732d..cf1f142a 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,107 @@ npm run build node . USER_NAME ``` +## Advanced example: automatic day/night switching + keeping output in other branch + +This alternative workflow generates two files, `day.svg` and `night.svg`, and pushes it to `output-3d-contrib` branch, keeping the main repo 'clean' from build artifacts. + +### step 1. Create special repository ([see above](#step-1-create-special-repository)) +### step 2. Create `conf/github-profile-3d-contrib.json` file in your repo: +```json:conf/github-profile-3d-contrib.json +[ + { + "type": "normal", + "fileName": "day.svg", + "backgroundColor": "#ffffff", + "foregroundColor": "#00000f", + "strongColor": "#111133", + "weakColor": "gray", + "radarColor": "#47a042", + "growingAnimation": true, + "contribColors": [ + "#efefef", + "#d8e887", + "#8cc569", + "#47a042", + "#1d6a23" + ] + }, + { + "type": "rainbow", + "fileName": "night.svg", + "backgroundColor": "#00000f", + "foregroundColor": "#eeeeff", + "strongColor": "rgb(255,200,55)", + "weakColor": "#aaaaaa", + "radarColor": "rgb(255,200,55)", + "growingAnimation": true, + "saturation": "50%", + "contribLightness": [ + "20%", + "30%", + "35%", + "40%", + "50%" + ], + "duration": "10s", + "hueRatio": -7 + } +] +``` + +### step 3. Create `.github/workflows/profile-3d-contrib.yml` workflow file in your repo: +```yaml:.github/workflows/profile-3d-contrib.yml +name: generate 3d chart for profile contributions + +on: + # run automatically every 24 hours + schedule: + - cron: "0 */24 * * *" + + # allows to manually run the job at any time + workflow_dispatch: + + # run on every push on the main branch + # don't forget to change if you're using 'master' branch + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + name: generate-github-profile-3d-contrib + steps: + - uses: actions/checkout@v3 + - uses: yoshi389111/github-profile-3d-contrib@0.7.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + USERNAME: ${{ github.repository_owner }} + SETTING_JSON: conf/github-profile-3d-contrib.json + + # push the content of to a branch + # the content will be available at https://raw.githubusercontent.com//// , or as github page + - name: push SVGs to the output-3d branch + uses: crazy-max/ghaction-github-pages@v3.1.0 + with: + target_branch: output-3d-contrib + build_dir: profile-3d-contrib + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +``` + +### step 4. Edit `README.md` in your repo, adding the following code: +Do not forget to replace `` and `` with your GitHub username. +```html +

+ + + + github profile contributions chart + +

+``` + ## Licence MIT License