127 lines
3.6 KiB
YAML
127 lines
3.6 KiB
YAML
name: main
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: oven-sh/setup-bun@v1
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- run: bun install --frozen-lockfile
|
|
|
|
- run: bun run build
|
|
working-directory: packages/solver-r
|
|
|
|
- run: npm run type
|
|
|
|
- run: bun test
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- run: cargo test
|
|
working-directory: packages/solver-r
|
|
|
|
- run: npm run lint
|
|
|
|
test-action:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: update action.yml to use image from local Dockerfile
|
|
run: |
|
|
sed -i "s/image: .*/image: Dockerfile/" action.yml
|
|
|
|
- name: generate-snake-game-from-github-contribution-grid
|
|
id: generate-snake
|
|
uses: ./
|
|
with:
|
|
github_user_name: platane
|
|
outputs: |
|
|
dist/github-contribution-grid-snake.svg
|
|
dist/github-contribution-grid-snake-dark.svg?palette=github-dark
|
|
dist/github-contribution-grid-snake.gif?color_snake=orange&color_dots=#bfd6f6,#8dbdff,#64a1f4,#4b91f1,#3c7dd9
|
|
|
|
- name: ensure the generated file exists
|
|
run: |
|
|
ls dist
|
|
test -f dist/github-contribution-grid-snake.svg
|
|
test -f dist/github-contribution-grid-snake-dark.svg
|
|
test -f dist/github-contribution-grid-snake.gif
|
|
|
|
- uses: crazy-max/ghaction-github-pages@v4.1.0
|
|
with:
|
|
target_branch: output
|
|
build_dir: dist
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
test-action-svg-only:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: oven-sh/setup-bun@v1
|
|
|
|
- run: bun install --frozen-lockfile
|
|
|
|
- name: build svg-only action
|
|
run: |
|
|
npm run build:action
|
|
rm -r svg-only/dist
|
|
mv packages/action/dist svg-only/dist
|
|
|
|
- name: generate-snake-game-from-github-contribution-grid
|
|
id: generate-snake
|
|
uses: ./svg-only
|
|
with:
|
|
github_user_name: platane
|
|
outputs: |
|
|
dist/github-contribution-grid-snake.svg
|
|
dist/github-contribution-grid-snake-dark.svg?palette=github-dark
|
|
dist/github-contribution-grid-snake-blue.svg?color_snake=orange&color_dots=#bfd6f6,#8dbdff,#64a1f4,#4b91f1,#3c7dd9
|
|
|
|
- name: ensure the generated file exists
|
|
run: |
|
|
ls dist
|
|
test -f dist/github-contribution-grid-snake.svg
|
|
test -f dist/github-contribution-grid-snake-dark.svg
|
|
test -f dist/github-contribution-grid-snake-blue.svg
|
|
|
|
- uses: crazy-max/ghaction-github-pages@v4.1.0
|
|
with:
|
|
target_branch: output-svg-only
|
|
build_dir: dist
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
deploy-ghpages:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pages: write
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: oven-sh/setup-bun@v1
|
|
|
|
- run: bun install --frozen-lockfile
|
|
|
|
- run: npm run build:demo
|
|
env:
|
|
GITHUB_USER_CONTRIBUTION_API_ENDPOINT: https://github-user-contribution.platane.workers.dev/github-user-contribution/
|
|
|
|
- uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: packages/demo/dist
|
|
|
|
- uses: actions/deploy-pages@v4
|
|
if: success() && github.ref == 'refs/heads/main'
|
|
|
|
- run: bunx wrangler deploy
|
|
if: success() && github.ref == 'refs/heads/main'
|
|
working-directory: packages/github-user-contribution-service
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|