diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..1b3ffb5 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,53 @@ +name: Publish + +on: + push: + tags: v[0-9]+.[0-9]+.[0-9]+.[0-9]+* + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: write + env: + package_name: lls-addon-luafilesystem + spec_version: "" # this gets set in the Get Rockspec Version step + + steps: + - name: Get Rockspec Version + run: | + if [[ "${{ github.ref_name }}" =~ ^v(.+)$ ]]; then + echo "spec_version=${BASH_REMATCH[1]}-1" >> $GITHUB_ENV + else + echo "rockspec version could not be matched" >&2 + exit 1 + fi + + - uses: actions/checkout@v4 + + - name: Set up Lua + uses: leafo/gh-actions-lua@v11 + with: + luaVersion: "5.4.8" + + - name: Set up LuaRocks + uses: leafo/gh-actions-luarocks@v5 + with: + luaRocksVersion: "3.12.2" + + - name: Write LuaRocks Rockspec + run: | + luarocks new_version \ + --tag ${{ github.ref_name }} \ + ${{ env.package_name }}-release-1.rockspec + + - name: Publish to LuaRocks + run: | + luarocks upload \ + "./${{ env.package_name }}-${{ env.spec_version }}.rockspec" \ + --api-key=${{ secrets.LUAROCKS_API_KEY }} + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: "${{ env.package_name }}-${{ env.spec_version }}.src.rock" diff --git a/lls-addon-luafilesystem-release-1.rockspec b/lls-addon-luafilesystem-release-1.rockspec new file mode 100644 index 0000000..ba06b3c --- /dev/null +++ b/lls-addon-luafilesystem-release-1.rockspec @@ -0,0 +1,22 @@ +rockspec_format = "3.0" +package = "lls-addon-luafilesystem" +version = "release-1" + +source = { + url = "git+https://github.com/LuaCATS/luafilesystem", +} + +description = { + summary = "LuaLS type definitions for LuaFileSystem library", + license = "MIT", + homepage = "https://github.com/LuaCATS/luafilesystem", +} + +build = { + type = "lls-addon", + settings = { + diagnostics = { + globals = { "lfs" }, + } + } +}