♻️ refactor(ci): trigger release after CI passes instead of running redundant tests
This commit is contained in:
@@ -1,22 +1,20 @@
|
|||||||
name: Release & Publish
|
name: Release & Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_run:
|
||||||
|
workflows: [CI]
|
||||||
|
types: [completed]
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths-ignore:
|
|
||||||
- '*.md'
|
|
||||||
- 'docs/**'
|
|
||||||
- '.github/workflows/ci.yml'
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Gate: only release if CI passed and there are releasable commits
|
|
||||||
check:
|
check:
|
||||||
name: Check for releasable commits
|
name: Check for releasable commits
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event.workflow_run.conclusion == 'success'
|
||||||
outputs:
|
outputs:
|
||||||
bump: ${{ steps.bump.outputs.bump }}
|
bump: ${{ steps.bump.outputs.bump }}
|
||||||
new_version: ${{ steps.bump.outputs.new_version }}
|
new_version: ${{ steps.bump.outputs.new_version }}
|
||||||
@@ -116,35 +114,9 @@ jobs:
|
|||||||
echo "CHANGELOG_EOF"
|
echo "CHANGELOG_EOF"
|
||||||
} >> "$GITHUB_OUTPUT"
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
test:
|
|
||||||
name: Pre-release tests
|
|
||||||
needs: check
|
|
||||||
if: needs.check.outputs.should_release == 'true'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20.x'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Type check
|
|
||||||
run: npm run type-check
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
- name: Unit & integration tests
|
|
||||||
run: npm test
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Version bump & release
|
name: Version bump & release
|
||||||
needs: [check, test]
|
needs: check
|
||||||
if: needs.check.outputs.should_release == 'true'
|
if: needs.check.outputs.should_release == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
|
|||||||
Reference in New Issue
Block a user