Skip to content

Commit f441f55

Browse files
committed
add nghttp2 auto update CI
1 parent f5c845d commit f441f55

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Update nghttp2
2+
3+
on:
4+
schedule:
5+
# Run daily at 00:00 UTC
6+
- cron: '0 0 * * *'
7+
workflow_dispatch:
8+
9+
jobs:
10+
check-and-update:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
submodules: recursive
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Get latest nghttp2 release
24+
id: latest_release
25+
run: |
26+
LATEST=$(curl -s https://api.github.com/repos/nghttp2/nghttp2/releases/latest | jq -r .tag_name)
27+
echo "version=$LATEST" >> $GITHUB_OUTPUT
28+
echo "Latest nghttp2 release: $LATEST"
29+
30+
- name: Get current nghttp2 version
31+
id: current_version
32+
run: |
33+
cd nghttp2
34+
CURRENT=$(git describe --tags)
35+
echo "version=$CURRENT" >> $GITHUB_OUTPUT
36+
echo "Current nghttp2 version: $CURRENT"
37+
cd ..
38+
39+
- name: Check if update is needed
40+
id: check_update
41+
run: |
42+
if [ "${{ steps.current_version.outputs.version }}" != "${{ steps.latest_release.outputs.version }}" ]; then
43+
echo "update_needed=true" >> $GITHUB_OUTPUT
44+
echo "Update needed from ${{ steps.current_version.outputs.version }} to ${{ steps.latest_release.outputs.version }}"
45+
else
46+
echo "update_needed=false" >> $GITHUB_OUTPUT
47+
echo "Already up to date"
48+
fi
49+
50+
- name: Update nghttp2 submodule
51+
if: steps.check_update.outputs.update_needed == 'true'
52+
run: |
53+
cd nghttp2
54+
git fetch --tags
55+
git checkout ${{ steps.latest_release.outputs.version }}
56+
cd ..
57+
58+
- name: Update Cargo.toml version
59+
if: steps.check_update.outputs.update_needed == 'true'
60+
run: |
61+
# Extract version without 'v' prefix
62+
NEW_VERSION="${{ steps.latest_release.outputs.version }}"
63+
NEW_VERSION="${NEW_VERSION#v}"
64+
65+
# Update version in Cargo.toml
66+
sed -i "s/^version = \".*\"/version = \"${NEW_VERSION}\"/" Cargo.toml
67+
68+
- name: Create Pull Request
69+
if: steps.check_update.outputs.update_needed == 'true'
70+
uses: peter-evans/create-pull-request@v7
71+
with:
72+
commit-message: "Update nghttp2 to ${{ steps.latest_release.outputs.version }}"
73+
title: "Update nghttp2 to ${{ steps.latest_release.outputs.version }}"
74+
body: |
75+
## Summary
76+
- Updates nghttp2 submodule from ${{ steps.current_version.outputs.version }} to ${{ steps.latest_release.outputs.version }}
77+
- Updates package version to ${{ steps.latest_release.outputs.version }}
78+
79+
## Changes
80+
- Submodule `nghttp2` updated to ${{ steps.latest_release.outputs.version }}
81+
- Cargo.toml version bumped
82+
83+
## Release Notes
84+
See: https://github.com/nghttp2/nghttp2/releases/tag/${{ steps.latest_release.outputs.version }}
85+
branch: update-nghttp2-${{ steps.latest_release.outputs.version }}
86+
delete-branch: true
87+
labels: dependencies, automated

0 commit comments

Comments
 (0)