-
Notifications
You must be signed in to change notification settings - Fork 56
76 lines (72 loc) · 2.6 KB
/
Copy pathbuild-release-dispatch.yaml
File metadata and controls
76 lines (72 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Build Release (Dispatch)
run-name: >-
Build Release (Dispatch) / ${{ inputs.kernel_name || github.event.pull_request.title || '' }} / request=${{ inputs.dispatch_key || '' }}
on:
# pull_request:
# types: [closed]
workflow_dispatch:
inputs:
kernel_name:
description: "Kernel directory name to build"
required: true
type: string
dispatch_key:
description: "Unique key for matching this run back to a bot dispatch"
required: false
type: string
permissions:
actions: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
validate:
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.validate.outputs.skip }}
kernel: ${{ steps.validate.outputs.kernel }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Validate kernel directory
id: validate
env:
PR_TITLE: ${{ github.event.pull_request.title }}
KERNEL: ${{ inputs.kernel_name }}
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
if [ -d "$KERNEL" ] && [ -f "$KERNEL/flake.nix" ] && [ -f "$KERNEL/build.toml" ]; then
echo "kernel=$KERNEL" >> $GITHUB_OUTPUT
echo "skip=false" >> $GITHUB_OUTPUT
else
echo "skip=true" >> $GITHUB_OUTPUT
fi
else
if KERNEL=$(python3 .github/workflows/validate-kernel-pr.py "release"); then
echo "kernel=$KERNEL" >> $GITHUB_OUTPUT
echo "skip=false" >> $GITHUB_OUTPUT
else
echo "skip=true" >> $GITHUB_OUTPUT
fi
fi
- name: Print result
env:
SKIP: ${{ steps.validate.outputs.skip }}
KERNEL: ${{ steps.validate.outputs.kernel }}
run: |
echo "skip=$SKIP"
echo "kernel=$KERNEL"
dispatch:
needs: validate
if: needs.validate.outputs.skip == 'false'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Dispatch release workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
KERNEL: ${{ needs.validate.outputs.kernel }}
REF: ${{ github.event.repository.default_branch || 'main' }}
run: |
python3 .github/scripts/dispatch.py "$KERNEL" --ref "$REF" --mode release