-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (38 loc) · 1.46 KB
/
ci.yml
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
name: CI
on:
push:
workflow_dispatch:
permissions: {}
jobs:
ci:
# This repo has no tests and nothing to lint, so we can't use regular CI.
# Instead, just directly dispatch tag release on push, and let that figure it out.
name: Dispatch tag patch release
runs-on: ubuntu-latest
if: github.repository_owner == 'silverstripe'
permissions:
actions: write
env:
GITHUB_REPOSITORY: ${{ github.repository }}
BRANCH: ${{ github.ref_name }}
LATEST_LOCAL_SHA: ${{ github.sha }}
steps:
- name: Dispatch tag patch release
shell: bash
id: dispatch-tag-patch-release
run: |
echo "LATEST_LOCAL_SHA is $LATEST_LOCAL_SHA"
# https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event
RESP_CODE=$(curl -w %{http_code} -s -L -o __response.json \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$GITHUB_REPOSITORY/actions/workflows/tag-patch-release.yml/dispatches \
-d "{\"ref\":\"$BRANCH\",\"inputs\":{\"latest_local_sha\":\"$LATEST_LOCAL_SHA\"}}"
)
if [[ $RESP_CODE != "204" ]]; then
echo "Failed to dispatch workflow - HTTP response code was $RESP_CODE"
cat __response.json
exit 1
fi