Skip to content

Commit fceb527

Browse files
chore: auto-sync
1 parent f5adb82 commit fceb527

4 files changed

Lines changed: 186 additions & 4 deletions

File tree

.github/workflows/lint.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- '**/*.lua'
8+
- '.luacheckrc'
9+
- '.stylua.toml'
10+
- '.luarc.json'
11+
- '.github/workflows/lint.yml'
12+
pull_request:
13+
branches: [main]
14+
paths:
15+
- '**/*.lua'
16+
- '.luacheckrc'
17+
- '.stylua.toml'
18+
- '.luarc.json'
19+
- '.github/workflows/lint.yml'
20+
workflow_dispatch:
21+
22+
jobs:
23+
luacheck:
24+
name: Luacheck
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v7
29+
30+
- name: Run Luacheck
31+
uses: lunarmodules/luacheck@v1
32+
33+
stylua:
34+
name: StyLua
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v7
39+
40+
- name: Run StyLua Check
41+
run: npx @johnnymorganz/stylua-bin --check .
42+
43+
lls:
44+
name: Lua Language Server
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v7
49+
50+
- name: Clone LuaCATS dependencies
51+
run: |
52+
mkdir -p ~/.local/share/lua/types
53+
cd ~/.local/share/lua/types
54+
git clone --depth 1 https://github.com/LuaCATS/busted.git
55+
git clone --depth 1 https://github.com/LuaCATS/luassert.git
56+
git clone --depth 1 https://github.com/LuaCATS/luafilesystem.git
57+
58+
- name: Install lua-language-server
59+
run: |
60+
LUALS_DIR="$HOME/.local/share/lua-language-server"
61+
mkdir -p "$LUALS_DIR"
62+
cd "$LUALS_DIR"
63+
gh release download -R LuaLS/lua-language-server -p "*linux-x64.tar.gz" --clobber
64+
tar -xzf *.tar.gz
65+
echo "$LUALS_DIR/bin" >> $GITHUB_PATH
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
69+
- name: Run LLS check
70+
run: lua-language-server --check .
71+
72+

.github/workflows/publish.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Publish to LuaRocks
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'src/**'
8+
- 'types/**/*.d.lua'
9+
- '*.rockspec'
10+
tags:
11+
- 'v*'
12+
workflow_dispatch:
13+
14+
jobs:
15+
publish:
16+
name: Publish
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Wait for Test workflow to pass
20+
uses: lewagon/wait-on-check-action@v1
21+
with:
22+
ref: ${{ github.sha }}
23+
repo-token: ${{ secrets.GITHUB_TOKEN }}
24+
check-regexp: '^Run Tests .*'
25+
26+
- name: Checkout code
27+
uses: actions/checkout@v7
28+
29+
- name: Install Lua
30+
uses: luarocks/gh-actions-lua@master
31+
with:
32+
luaVersion: "5.5"
33+
34+
- name: Install LuaRocks
35+
uses: luarocks/gh-actions-luarocks@master
36+
37+
- name: Resolve Rockspec
38+
shell: bash
39+
run: |
40+
PACKAGE_NAME=$(jq -r '.package' .github/config.json)
41+
ROCKSPEC="${PACKAGE_NAME}-scm-1.rockspec"
42+
if [ ! -f "$ROCKSPEC" ]; then
43+
echo "No rockspec file found: $ROCKSPEC" >&2
44+
exit 1
45+
fi
46+
echo "rockspec=$ROCKSPEC" >> "$GITHUB_ENV"
47+
echo "package_name=$PACKAGE_NAME" >> "$GITHUB_ENV"
48+
49+
- name: Build and Upload to LuaRocks
50+
shell: bash
51+
env:
52+
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
53+
run: |
54+
set -euo pipefail
55+
56+
# Detect if this is a tag push
57+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
58+
TAG_NAME="${{ github.ref_name }}"
59+
VERSION="${TAG_NAME#v}"
60+
BASE_VERSION="$VERSION"
61+
62+
# Query LuaRocks once to find the latest revision for this version
63+
LATEST_REV=$(luarocks search --porcelain "$package_name" --only-server=https://luarocks.org/manifests/bluelua 2>/dev/null |
64+
awk -v pkg="$package_name" -v ver="${BASE_VERSION}" '
65+
$1 == pkg && $2 ~ "^"ver"-" {
66+
split($2, a, "-")
67+
print a[2]
68+
exit
69+
}
70+
')
71+
REVISION=$((LATEST_REV + 1))
72+
VERSION="${BASE_VERSION}-${REVISION}"
73+
74+
ROCKSPEC_FILENAME="${package_name}-${VERSION}.rockspec"
75+
sed -e "s/version = .*/version = \"${VERSION}\"/" \
76+
-e "s/source = {/source = {\n tag = \"${TAG_NAME}\",/" \
77+
"$rockspec" > "$ROCKSPEC_FILENAME"
78+
else
79+
# Dev publish: upload the existing SCM rockspec as-is (LuaRocks updates/overwrites it in place)
80+
ROCKSPEC_FILENAME="$rockspec"
81+
fi
82+
83+
echo "Generated/loaded rockspec content:"
84+
cat "$ROCKSPEC_FILENAME"
85+
86+
echo "Uploading $ROCKSPEC_FILENAME to LuaRocks..."
87+
luarocks upload "$ROCKSPEC_FILENAME" --api-key="${LUAROCKS_API_KEY}" --force

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'src/**'
8+
- 'lua/**'
9+
- '.github/release-please-manifest.json'
10+
- '.github/release-please-config.json'
11+
- '.github/workflows/release.yml'
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
release-please:
20+
name: Release Please
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: googleapis/release-please-action@v5
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
config-file: .github/release-please-config.json
27+
manifest-file: .github/release-please-manifest.json

.github/workflows/test.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
paths:
77
- 'src/**'
88
- 'lua/**'
9-
- '**/*.rockspec'
109
- 'tests/**'
1110
- '.busted'
1211
- '.github/workflows/test.yml'
@@ -15,10 +14,7 @@ on:
1514
paths:
1615
- 'src/**'
1716
- 'lua/**'
18-
- '**/*.rockspec'
1917
- 'tests/**'
20-
- '.busted'
21-
- '.github/workflows/test.yml'
2218
workflow_dispatch:
2319

2420
jobs:

0 commit comments

Comments
 (0)