aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/release.yml22
-rw-r--r--Makefile6
-rw-r--r--scripts/luarocks-upload.sh10
-rw-r--r--scripts/test-luarocks-install.sh4
4 files changed, 42 insertions, 0 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..11ce428d
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,22 @@
+name: "release"
+on:
+ push:
+ tags:
+ - '*'
+jobs:
+ luarocks-upload:
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v3
+ - uses: leafo/gh-actions-lua@v9
+ with:
+ luaVersion: "luajit-2.1.0-beta3"
+ - uses: leafo/gh-actions-luarocks@v4
+ - name: Install dkjson
+ run: luarocks install dkjson
+ - name: Luarocks Upload
+ env:
+ LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
+ run: make luarocks_upload
+ - name: Install release
+ run: make test_luarocks_install
diff --git a/Makefile b/Makefile
index 15aa212c..ef3c391e 100644
--- a/Makefile
+++ b/Makefile
@@ -10,3 +10,9 @@ lint:
stylua --check .
.PHONY: test lint
+
+luarocks_upload:
+ bash ./scripts/luarocks-upload.sh
+
+test_luarocks_install:
+ bash ./scripts/test-luarocks-install.sh
diff --git a/scripts/luarocks-upload.sh b/scripts/luarocks-upload.sh
new file mode 100644
index 00000000..8c4ff1f4
--- /dev/null
+++ b/scripts/luarocks-upload.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+# Expects the LUAROCKS_API_KEY secret to be set
+
+TMP_DIR=$(mktemp -d)
+MODREV=$(git describe --tags --always --first-parent | tr -d "v")
+DEST_ROCKSPEC="$TMP_DIR/nvim-lspconfig-$MODREV-1.rockspec"
+cp "nvim-lspconfig-scm-1.rockspec" "$DEST_ROCKSPEC"
+sed -i "s/= 'scm'/= '$MODREV'/g" "$DEST_ROCKSPEC"
+luarocks upload "$DEST_ROCKSPEC" --api-key="$LUAROCKS_API_KEY"
diff --git a/scripts/test-luarocks-install.sh b/scripts/test-luarocks-install.sh
new file mode 100644
index 00000000..8d8d3242
--- /dev/null
+++ b/scripts/test-luarocks-install.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+
+MODREV=$(git describe --tags --always --first-parent | tr -d "v")
+luarocks install "nvim-lspconfig" "$MODREV"