-
Notifications
You must be signed in to change notification settings - Fork 31
140 lines (124 loc) · 4.62 KB
/
auto-update.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Auto Update
on:
schedule:
- cron: '0 0 * * FRI'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install hub
run: sudo apt-get install -y hub
- uses: cachix/install-nix-action@V27
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v15
with:
name: vulkan-haskell
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: Init git
run: |
git config user.name 'Three Of Twelve'
git config user.email '[email protected]'
- id: init
run: |
message="> $(curl https://home.monoid.al/quote/tuvok --fail || echo "No response. He's deactivated his communication system.")"
message="${message//'%'/'%25'}"
message="${message//$'\n'/'%0A'}"
message="${message//$'\r'/'%0D'}"
issue_body=~/issue_body
echo "::set-output name=issue_body::$issue_body"
echo "$message" > "$issue_body"
echo >> "$issue_body"
pr_body=~/pr_body
echo "::set-output name=pr_body::$pr_body"
echo "$message" > "$pr_body"
echo >> "$pr_body"
- name: Build dependencies
run: |
nix-build -A generate-new
nix-build '<nixpkgs>' -A python3 -A python3Packages.pyparsing -A asciidoctor -A gnumake -A nodejs -A nodePackages.he -A nodePackages.escape-string-regexp
nix-build '<nixpkgs>' -A haskellPackages.hpack
nix-build '<nixpkgs>' -A doxygen
- name: run update.sh
id: update
env:
issue_body: ${{ steps.init.outputs.issue_body }}
pr_body: ${{ steps.init.outputs.pr_body }}
tok: ${{ secrets.TUVOK_TOKEN }}
run: |
ndd="$HOME/no-doc-diff.patch"
set +e
./scripts/update.sh --no-doc-diff "$ndd" 2>&1 | tee --append ~/update_output
code=${PIPESTATUS[0]}
set -e
{
echo '<details> <summary>log of `generate-new/bin/vk`</summary> <p>'
echo ''
echo '```'
cat ~/update_output
echo '```'
echo ''
echo '</p></details>'
} >> "$issue_body"
gist="$HOME/gist-post.json"
make_gist(){
set -o pipefail
jq -R -s '{"description": "Vulkan update diff", "public": false, "files": {"vulkan.diff": {"content": .}}}' < "$ndd" > "$gist" &&
curl \
--header "Content-Type: application/json" \
--data @"$gist" \
--user "$tok:" \
https://api.github.com/gists |
jq --raw-output .html_url |
sed 's/.*/[Diff without documentation changes](\0)/'
}
gist_url=$(make_gist || echo "Failed to create gist for diff")
echo gist_url = "$gist_url"
{
echo "pr_message<<EOF_HS_VK"
cat "$pr_body"
echo
echo "$gist_url"
echo "EOF_HS_VK"
} >> "$GITHUB_ENV"
(exit "$code")
- id: check_pr
run: |
echo "::set-output name=create_pr::true"
hub pr list --state open --head ThreeOfTwelve:vulkan-update-${{ steps.update.outputs.vulkan_version }} --format $'%U\n' | while read u; do
echo "PR already exists: $u"
echo "::set-output name=create_pr::false"
done
env:
GITHUB_TOKEN: ${{ secrets.TUVOK_TOKEN }}
- name: Create Pull Request
uses: peter-evans/[email protected]
if: steps.check_pr.outputs.create_pr == 'true'
with:
token: ${{ secrets.TUVOK_TOKEN }}
push-to-fork: ThreeOfTwelve/vulkan
delete-branch: true
branch: vulkan-update-${{ steps.update.outputs.vulkan_version }}
title: Update Vulkan to ${{ steps.update.outputs.vulkan_version }}
body: ${{ env.pr_message }}
- id: check_issue
if: ${{ failure() }}
run: |
echo "::set-output name=create_issue::true"
hub issue --state open --format $'%U %t\n' | grep -i 'Failed to regenerate source for Vulkan ${{ steps.update.outputs.vulkan_version }}' | while read u; do
echo "Issue already exists: $u"
echo "::set-output name=create_issue::false"
done
env:
GITHUB_TOKEN: ${{ secrets.TUVOK_TOKEN }}
- name: Create issue for failure
if: ${{ failure() && steps.check_issue.outputs.create_issue == 'true' }}
uses: peter-evans/create-issue-from-file@v5
with:
title: Failed to regenerate source for Vulkan ${{ steps.update.outputs.vulkan_version }}
content-filepath: ${{ steps.init.outputs.issue_body }}
token: ${{ secrets.TUVOK_TOKEN }}