-
Notifications
You must be signed in to change notification settings - Fork 39
132 lines (111 loc) · 5.42 KB
/
update-prs.yml
File metadata and controls
132 lines (111 loc) · 5.42 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
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
name: Update Luau/Lute
on:
schedule:
- cron: '0 0 * * 6'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update-luau:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get latest Luau release
id: latest-release
run: |
# Fetch the latest release tag from luau-lang/luau
LATEST_TAG=$(curl -s https://api.github.com/repos/luau-lang/luau/releases/latest | jq -r '.tag_name')
echo "Latest Luau release: $LATEST_TAG"
echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
# Fetch the commit hash for this tag
COMMIT_HASH=$(curl -s https://api.github.com/repos/luau-lang/luau/git/ref/tags/$LATEST_TAG | jq -r '.object.sha')
echo "Commit hash: $COMMIT_HASH"
echo "commit=$COMMIT_HASH" >> $GITHUB_OUTPUT
- name: Check current version
id: current-version
run: |
CURRENT_BRANCH=$(grep '^branch' extern/luau.tune | sed -E 's/^branch *= *"(.*)"/\1/')
echo "Current Luau version: $CURRENT_BRANCH"
echo "branch=$CURRENT_BRANCH" >> $GITHUB_OUTPUT
- name: Update version files
if: steps.current-version.outputs.branch != steps.latest-release.outputs.tag
run: |
# Update the branch and revision in luau.tune if needed
if [ "${{ steps.current-version.outputs.branch }}" != "${{ steps.latest-release.outputs.tag }}" ]; then
sed -i 's/^branch = ".*"/branch = "${{ steps.latest-release.outputs.tag }}"/' extern/luau.tune
sed -i 's/^revision = ".*"/revision = "${{ steps.latest-release.outputs.commit }}"/' extern/luau.tune
echo "Updated luau.tune:"
cat extern/luau.tune
fi
- name: Create Pull Request
if: steps.current-version.outputs.branch != steps.latest-release.outputs.tag
uses: luau-lang/create-pull-request@v7
with:
commit-message: "chore: update dependencies"
title: "Update Luau to ${{ steps.latest-release.outputs.tag }}"
body: |
${{ format('**Luau**: Updated from `{0}` to `{1}`', steps.current-version.outputs.branch, steps.latest-release.outputs.tag) }}
**Release Notes:**
${{ format('https://github.com/luau-lang/luau/releases/tag/{0}', steps.latest-release.outputs.tag) }}
---
*This PR was automatically created by the [Update Luau workflow](https://github.com/${{ github.repository }}/actions/workflows/update-prs.yml)*
branch: update-luau
delete-branch: true
- name: No update needed
if: steps.current-version.outputs.branch == steps.latest-release.outputs.tag
run: |
echo "Luau is already up to date: ${{ steps.current-version.outputs.branch }}"
update-lute:
runs-on: ubuntu-latest
needs: update-luau
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get latest Lute release
id: latest-release
run: |
# Fetch the latest release tag from luau-lang/lute
LATEST_LUTE=$(
curl -s https://api.github.com/repos/luau-lang/lute/releases \
| jq -r 'map(select(.draft | not))[0]?.tag_name'
)
echo "Latest Lute release: $LATEST_LUTE"
echo "tag=$LATEST_LUTE" >> $GITHUB_OUTPUT
- name: Check current version
id: current-version
run: |
CURRENT_LUTE=$(grep '^lute = ' rokit.toml | sed -E 's/^lute = ".*@(.*)"/\1/')
echo "Current Lute version: $CURRENT_LUTE"
echo "lute=$CURRENT_LUTE" >> $GITHUB_OUTPUT
- name: Update version files
run: |
# Update lute version in rokit.toml and foreman.toml
if [ "${{ steps.current-version.outputs.lute }}" != "${{ steps.latest-release.outputs.tag }}" ]; then
sed -i 's/^lute = "luau-lang\/lute@.*"/lute = "luau-lang\/lute@${{ steps.latest-release.outputs.tag }}"/' rokit.toml
echo "Updated rokit.toml:"
cat rokit.toml
echo ""
sed -i 's/^lute = { github = "luau-lang\/lute", version = ".*" }/lute = { github = "luau-lang\/lute", version = "=${{ steps.latest-release.outputs.tag }}" }/' foreman.toml
echo "Updated foreman.toml:"
cat foreman.toml
fi
- name: Create Pull Request
if: steps.current-version.outputs.lute != steps.latest-release.outputs.tag
uses: luau-lang/create-pull-request@v7
with:
commit-message: "chore: update dependencies"
title: "Update Lute to ${{ steps.latest-release.outputs.tag }}"
body: |
${{ format('**Lute**: Updated from `{0}` to `{1}`', steps.current-version.outputs.lute, steps.latest-release.outputs.tag)}}
**Release Notes:**
${{ format('https://github.com/luau-lang/lute/releases/tag/{0}', steps.latest-release.outputs.tag)}}
---
*This PR was automatically created by the [Update Luau workflow](https://github.com/${{ github.repository }}/actions/workflows/update-prs.yml)*
branch: update-lute
delete-branch: true
- name: No update needed
if: steps.current-version.outputs.lute == steps.latest-release.outputs.tag
run: |
echo "Lute is already up to date: ${{ steps.current-version.outputs.lute }}"