-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (91 loc) · 3.3 KB
/
Copy pathpublish.yml
File metadata and controls
109 lines (91 loc) · 3.3 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
name: Update LuaLS Addon
on:
push:
tags:
- 'release/**'
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., v1.5.0-2026.04.30)'
required: true
type: string
permissions:
contents: write
jobs:
update-addon:
runs-on: ubuntu-latest
steps:
- name: Resolve version
run: |
if [ "${{ github.event_name }}" = "push" ]; then
VERSION="${GITHUB_REF_NAME#release/}"
else
VERSION=${{ github.event.inputs.version }}
fi
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
- name: Checkout main source
uses: actions/checkout@v4
with:
ref: main
- name: Save ethos.lua temporally
run: |
mkdir -p /tmp/ethos-addon
cp library/ethos.lua /tmp/ethos-addon/
- name: Checkout luals-addon branch
uses: actions/checkout@v4
with:
ref: luals-addon
clean: true
- name: Update ethos.lua in luals-addon branch
run: |
mkdir -p library
cp /tmp/ethos-addon/ethos.lua library/ethos.lua
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add library/ethos.lua
if git diff-index --quiet HEAD; then
echo "No changes to commit."
else
git commit -m "Update ethos.lua to $VERSION"
git tag "$VERSION"
git push origin luals-addon --tags
fi
- name: Checkout LLS-Addons fork
uses: actions/checkout@v4
with:
repository: flyingeek/LLS-Addons
token: ${{ secrets.ADDON_PAT }}
path: LLS-Addons
submodules: false
- name: Sync fork with upstream
run: gh repo sync flyingeek/LLS-Addons --source LuaLS/LLS-Addons --branch main
env:
GH_TOKEN: ${{ secrets.ADDON_PAT }}
- name: Update submodule and Create PR
working-directory: LLS-Addons
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Replace invalid branch chars safely
CLEAN_VERSION=$(echo "$VERSION" | tr -cd '[:alnum:].-')
BRANCH_NAME="update-ethos-addon-${CLEAN_VERSION}"
git pull origin main
git checkout -B $BRANCH_NAME
# Init only the ethos submodule (avoid broken submodules from other addons)
git submodule update --init addons/ethos/module
# Update the submodule to point to the newest commit on luals-addon branch
git submodule update --remote addons/ethos/module
git add addons/ethos/module
if git diff-index --quiet HEAD; then
echo "No changes to submodule."
else
git commit -m "Update ethos addon to $VERSION"
git push --force origin $BRANCH_NAME
gh pr create --repo LuaLS/LLS-Addons \
--title "Update ethos addon to $VERSION" \
--body "Automated update of ETHOS Lua definitions to version $VERSION." \
--head flyingeek:$BRANCH_NAME \
--base main
fi
env:
GH_TOKEN: ${{ secrets.ADDON_PAT }}