mirror of
https://github.com/ryanwtf7/hianime-api.git
synced 2026-04-17 13:31:44 +00:00
92 lines
2.3 KiB
YAML
92 lines
2.3 KiB
YAML
name: Automated Build and Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
paths-ignore:
|
|
- '**.md'
|
|
- '.gitignore'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- main
|
|
|
|
jobs:
|
|
quality-checks:
|
|
name: Code Quality & Security
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.bun/install/cache
|
|
node_modules
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock', '**/package.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Run linter
|
|
run: bun run lint
|
|
|
|
- name: Check code formatting
|
|
run: bunx prettier --check .
|
|
continue-on-error: true
|
|
|
|
- name: Run tests
|
|
run: bun run test:all
|
|
|
|
release:
|
|
name: Tag and Release
|
|
runs-on: ubuntu-latest
|
|
needs: quality-checks
|
|
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: GitHub Tag Action
|
|
id: tag_action
|
|
uses: anothrNick/github-tag-action@1.71.0
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
WITH_V: true
|
|
DEFAULT_BUMP: patch
|
|
|
|
- name: Create GitHub Release
|
|
if: steps.tag_action.outputs.new_tag != ''
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.tag_action.outputs.new_tag }}
|
|
name: Release ${{ steps.tag_action.outputs.new_tag }}
|
|
body: |
|
|
Automated release for version ${{ steps.tag_action.outputs.new_tag }}
|
|
|
|
Changes in this version:
|
|
${{ github.event.head_commit.message }}
|
|
generate_release_notes: true
|
|
draft: false
|
|
prerelease: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|