Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,21 @@ permissions:
pull-requests: write

jobs:
# Intentionally strict: forks must not publish releases or use upstream secrets.
upstream-only:
name: Verify upstream release repository
if: github.repository == 'rtk-ai/rtk'
runs-on: ubuntu-latest
permissions: {}
steps:
- run: echo "Release automation enabled for ${{ github.repository }}"

# ═══════════════════════════════════════════════
# DEVELOP PATH: Pre-release
# ═══════════════════════════════════════════════

pre-release:
needs: upstream-only
if: >-
github.ref == 'refs/heads/develop'
|| (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master')
Expand Down Expand Up @@ -98,7 +108,10 @@ jobs:
# ═══════════════════════════════════════════════

release-please:
if: github.ref == 'refs/heads/master' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
needs: upstream-only
if: >-
github.ref == 'refs/heads/master'
&& (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
Expand All @@ -122,7 +135,7 @@ jobs:
build-release:
name: Build and upload release assets
needs: release-please
if: ${{ needs.release-please.outputs.release_created == 'true' }}
if: needs.release-please.outputs.release_created == 'true'
uses: ./.github/workflows/release.yml
with:
tag: ${{ needs.release-please.outputs.tag_name }}
Expand All @@ -133,7 +146,7 @@ jobs:
update-latest-tag:
name: Update 'latest' tag
needs: [release-please, build-release]
if: ${{ needs.release-please.outputs.release_created == 'true' }}
if: needs.release-please.outputs.release_created == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v3
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/next-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ permissions: {}

jobs:
update-next-release:
if: github.event.pull_request.merged == true
# Intentionally strict: this job edits the upstream release PR using upstream secrets.
if: github.repository == 'rtk-ai/rtk' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1
Expand Down
Loading