-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (90 loc) · 3.64 KB
/
Copy pathupdate.yml
File metadata and controls
105 lines (90 loc) · 3.64 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
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
name: Sync VMAware header and create release branches
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Get latest VMAware release tag
id: vmaware
run: |
set -e
tag=$(curl -s https://api.github.com/repos/NotRequiem/VMAware/releases/latest \
| jq -r .tag_name)
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Check if release branch exists
id: check_tag
run: |
version="${{ steps.vmaware.outputs.tag }}"
if git ls-remote --heads origin | grep -q "refs/heads/$version$"; then
echo "is_new_tag=false" >> "$GITHUB_OUTPUT"
else
echo "is_new_tag=true" >> "$GITHUB_OUTPUT"
fi
- name: Get latest VMAware main SHA
id: sha
run: |
sha=$(curl -s https://api.github.com/repos/NotRequiem/VMAware/commits/main \
| jq -r .sha)
echo "sha=$sha" >> "$GITHUB_OUTPUT"
- name: Update vendored header
run: |
curl -fsSL -o deps/vmaware.hpp \
https://raw.githubusercontent.com/NotRequiem/VMAware/main/src/vmaware.hpp
- name: Check if header changed
id: changed
run: |
git diff --quiet deps/vmaware.hpp \
&& echo "changed=false" >> "$GITHUB_OUTPUT" \
|| echo "changed=true" >> "$GITHUB_OUTPUT"
- name: Test
id: test
if: steps.changed.outputs.changed == 'true'
run: |
cargo run --example basic 2>&1 && echo "success=true" >> "$GITHUB_OUTPUT" || echo "success=false" >> "$GITHUB_OUTPUT"
- name: Configure git
if: steps.changed.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Push to master
if: steps.changed.outputs.changed == 'true' && steps.test.outputs.success == 'true'
run: |
git add deps/vmaware.hpp
git commit -m "chore: sync VMAware main (${{ steps.sha.outputs.sha }})"
git push
- name: Create release branch
if: steps.check_tag.outputs.is_new_tag == 'true' && steps.test.outputs.success == 'true' && steps.changed.outputs.changed == 'true'
run: |
version="${{ steps.vmaware.outputs.tag }}"
version_clean="${version#v}"
git checkout -b $version
sed -i "s/^version = .*/version = \"$version_clean\"/" Cargo.toml
git add Cargo.toml
git commit -m "chore: bump version to $version_clean for VMAware $version"
git push origin $version
git checkout -
- name: Open PR on failure
if: steps.changed.outputs.changed == 'true' && steps.test.outputs.success == 'false'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update VMAware to ${{ steps.vmaware.outputs.tag }}"
title: "⚠️ VMAware update failed to build"
branch: update-vmaware-${{ steps.vmaware.outputs.tag }}
assignees: MarcelDev
draft: true
body: |
VMAware updated, but running the example failed (runtime panic, or compile error).
Review the changes, and fix it before merging.
VMAware ref: ${{ steps.vmaware.outputs.tag }}
Main SHA: ${{ steps.sha.outputs.sha }}