mirror of
https://github.com/LukeHagar/stats-action.git
synced 2025-12-06 04:21:26 +00:00
54 lines
1.2 KiB
YAML
54 lines
1.2 KiB
YAML
name: Release GitHub Action
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Run tests
|
|
run: bun test
|
|
|
|
- name: Type check
|
|
run: bun run typecheck
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
concurrency:
|
|
group: release-action
|
|
cancel-in-progress: true
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get package info
|
|
id: package-info
|
|
uses: luizfelipelaviola/get-package-info@v1
|
|
with:
|
|
path: .
|
|
|
|
- name: Publish Draft Release if doesn't exist
|
|
run: |
|
|
if ! gh release view ${{ steps.package-info.outputs.version }} >/dev/null 2>&1; then
|
|
gh release create --draft ${{ steps.package-info.outputs.version }} --title "${{ steps.package-info.outputs.version }}" --generate-notes
|
|
fi
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|