Skip to content

Commit

Permalink
chore: adjust "needs"
Browse files Browse the repository at this point in the history
Signed-off-by: Bart Smykla <[email protected]>
  • Loading branch information
bartsmykla committed Dec 12, 2024
1 parent 2a0b6c0 commit 3ce6028
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions .github/workflows/ci-stability-release-branches.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check CI stability of release branches
name: "ci-stability-release-branches"

on:
schedule:
Expand All @@ -11,23 +11,23 @@ on:
release_branch:
description: "The release branch to process"
required: true
# this is just temporary
pull_request:
branches: ["master", "release-*"]

permissions:
contents: read

concurrency:
group: ${{ format('{0}-{1}', github.workflow, github.event_name) }}

jobs:
fetch-release-branches:
runs-on: ubuntu-24.04
outputs:
branches: ${{ steps.generate-branches.outputs.branches }}
env:
GITHUB_TOKEN: ${{ github.token }}
steps:
- name: Fetch release branches
id: generate-branches
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
# Fetch active branches from the repository
ACTIVE_BRANCHES=$(
Expand All @@ -39,17 +39,16 @@ jobs:
RELEASE_BRANCHES=$(echo "$ACTIVE_BRANCHES" | jq -c 'map(select(. != "master"))')
# Write "branches" to GITHUB_OUTPUT
echo "branches=${RELEASE_BRANCHES}" >> $GITHUB_OUTPUT
echo "branches=$RELEASE_BRANCHES" >> $GITHUB_OUTPUT
validate-dispatch:
needs: fetch-release-branches
if: ${{ github.event_name == 'workflow_dispatch' }}
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-24.04
outputs:
branch: ${{ steps.validate-branch.outputs.branch }}
steps:
- name: Validate release branch from workflow_dispatch
id: validate-branch
- id: validate-branch
env:
RELEASE_BRANCHES: ${{ needs.fetch-release-branches.outputs.branches }}
MANUAL_BRANCH: ${{ github.event.inputs.release_branch }}
Expand All @@ -69,13 +68,12 @@ jobs:
validate-schedule:
needs: fetch-release-branches
if: ${{ github.event_name == 'schedule' }}
if: github.event_name == 'schedule'
runs-on: ubuntu-24.04
outputs:
branch: ${{ steps.validate-branch.outputs.branch }}
steps:
- name: Validate release branch from schedule
id: validate-branch
- id: validate-branch
env:
SCHEDULED_TIME: ${{ github.event.schedule }}
RELEASE_BRANCHES: ${{ needs.fetch-release-branches.outputs.branches }}
Expand All @@ -97,20 +95,14 @@ jobs:
fi
trigger-workflow:
needs: [fetch-release-branches, validate-dispatch, validate-schedule]
if: |
always()
&& contains(needs.*.result, 'success')
&& !contains(needs.*.result, 'failure')
needs: [validate-dispatch, validate-schedule]
if: needs.validate-dispatch.result == 'success' || needs.validate-schedule.result == 'success'
runs-on: ubuntu-24.04
permissions:
actions: write
env:
GITHUB_TOKEN: ${{ github.token }}
steps:
- name: Trigger "build-test-distribute" workflow
env:
BRANCH: ${{ needs.validate-dispatch.outputs.branch || needs.validate-schedule.outputs.branch }}
- env:
RELEASE_BRANCH: ${{ needs.validate-dispatch.outputs.branch || needs.validate-schedule.outputs.branch }}
GITHUB_TOKEN: ${{ github.token }}
run: |
# Trigger the "build-test-distribute" workflow on the release branch
gh workflow run build-test-distribute --ref "$BRANCH"

0 comments on commit 3ce6028

Please sign in to comment.