mirror of
https://github.com/LucasVbr/LucasVbr.git
synced 2026-05-14 01:21:52 +00:00
107 lines
2.4 KiB
YAML
107 lines
2.4 KiB
YAML
name: Generate README and Deploy to Main
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Cache Bun dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.bun/install/cache
|
|
key: bun-${{ runner.os }}-${{ hashFiles('bun.lockb') }}
|
|
restore-keys: |
|
|
bun-${{ runner.os }}-
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Lint code
|
|
run: bun run lint
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
needs: lint
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Cache Bun dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.bun/install/cache
|
|
key: bun-${{ runner.os }}-${{ hashFiles('bun.lockb') }}
|
|
restore-keys: |
|
|
bun-${{ runner.os }}-
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Run tests
|
|
run: bun test
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
|
|
steps:
|
|
- name: Checkout dev branch
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: dev
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Cache Bun dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.bun/install/cache
|
|
key: bun-${{ runner.os }}-${{ hashFiles('bun.lockb') }}
|
|
restore-keys: |
|
|
bun-${{ runner.os }}-
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Run README generator
|
|
run: bun run build
|
|
|
|
- name: Set up Git
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: Save generated README to main branch
|
|
run: |
|
|
mv build/README.md /tmp/README.md
|
|
git checkout main
|
|
mv /tmp/README.md README.md
|
|
|
|
- name: Commit and push changes
|
|
run: |
|
|
git add README.md
|
|
git commit -m "chore: update README [CI]" || echo "No changes to commit"
|
|
git push origin main
|