-
Notifications
You must be signed in to change notification settings - Fork 1
93 lines (80 loc) · 3.22 KB
/
update-nghttp2.yml
File metadata and controls
93 lines (80 loc) · 3.22 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
name: Update nghttp2
on:
schedule:
# Run daily at 00:00 UTC
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
check-and-update:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch tags for submodule
run: |
cd nghttp2
git fetch --tags --no-recurse-submodules
cd ..
- name: Get latest nghttp2 release
id: latest_release
run: |
LATEST=$(curl -s https://api.github.com/repos/nghttp2/nghttp2/releases/latest | jq -r .tag_name)
echo "version=$LATEST" >> $GITHUB_OUTPUT
echo "Latest nghttp2 release: $LATEST"
- name: Get current nghttp2 version
id: current_version
run: |
cd nghttp2
CURRENT=$(git describe --tags)
echo "version=$CURRENT" >> $GITHUB_OUTPUT
echo "Current nghttp2 version: $CURRENT"
cd ..
- name: Check if update is needed
id: check_update
run: |
if [ "${{ steps.current_version.outputs.version }}" != "${{ steps.latest_release.outputs.version }}" ]; then
echo "update_needed=true" >> $GITHUB_OUTPUT
echo "Update needed from ${{ steps.current_version.outputs.version }} to ${{ steps.latest_release.outputs.version }}"
else
echo "update_needed=false" >> $GITHUB_OUTPUT
echo "Already up to date"
fi
- name: Update nghttp2 submodule
if: steps.check_update.outputs.update_needed == 'true'
run: |
cd nghttp2
git fetch --tags
git checkout ${{ steps.latest_release.outputs.version }}
cd ..
- name: Update Cargo.toml version
if: steps.check_update.outputs.update_needed == 'true'
run: |
# Extract version without 'v' prefix
NEW_VERSION="${{ steps.latest_release.outputs.version }}"
NEW_VERSION="${NEW_VERSION#v}"
# Update version in Cargo.toml
sed -i "s/^version = \".*\"/version = \"${NEW_VERSION}\"/" Cargo.toml
- name: Create Pull Request
if: steps.check_update.outputs.update_needed == 'true'
uses: peter-evans/create-pull-request@v7
with:
commit-message: "Update nghttp2 to ${{ steps.latest_release.outputs.version }}"
title: "Update nghttp2 to ${{ steps.latest_release.outputs.version }}"
body: |
## Summary
- Updates nghttp2 submodule from ${{ steps.current_version.outputs.version }} to ${{ steps.latest_release.outputs.version }}
- Updates package version to ${{ steps.latest_release.outputs.version }}
## Changes
- Submodule `nghttp2` updated to ${{ steps.latest_release.outputs.version }}
- Cargo.toml version bumped
## Release Notes
See: https://github.com/nghttp2/nghttp2/releases/tag/${{ steps.latest_release.outputs.version }}
branch: update-nghttp2-${{ steps.latest_release.outputs.version }}
delete-branch: true
labels: dependencies, automated