From c3bad2625a72d3f0b0ac1bd4650fc3c9e46456ad Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Tue, 3 Jan 2023 17:36:05 +0100 Subject: [PATCH] ci: add luarocks upload release workflow @Conni2461 see https://github.com/nvim-telescope/telescope.nvim/pull/2276#issuecomment-1368446702. --- .github/workflows/release.yml | 15 +++++++++++++++ Makefile | 3 +++ plenary.nvim-scm-1.rockspec | 2 +- scripts/luarocks-upload.sh | 10 ++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 scripts/luarocks-upload.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..46d4c531 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,15 @@ +name: "release" +on: + push: + tags: + - 'v*' +jobs: + luarocks-upload: + runs-on: ubuntu-20.04 + steps: + - uses: leafo/gh-actions-lua@v9 + - uses: leafo/gh-actions-luarocks@v4 + - name: Install dkjson + run: luarocks install dkjson + - name: Luarocks Upload + run: make luarocks_upload diff --git a/Makefile b/Makefile index 46b875bf..3353e598 100644 --- a/Makefile +++ b/Makefile @@ -3,3 +3,6 @@ test: generate_filetypes: nvim --headless -c 'luafile scripts/update_filetypes_from_github.lua' -c 'qa!' + +luarocks_upload: + bash ./scripts/luarocks-upload.sh diff --git a/plenary.nvim-scm-1.rockspec b/plenary.nvim-scm-1.rockspec index fecd7b3d..d4415ca1 100644 --- a/plenary.nvim-scm-1.rockspec +++ b/plenary.nvim-scm-1.rockspec @@ -19,7 +19,7 @@ dependencies = { } source = { - url = 'http://github.com/nvim-lua/plenary.nvim/archive/v' .. _MODREV .. '.zip', + url = 'http://github.com/nvim-lua/plenary.nvim/archive/' .. _MODREV .. '.zip', dir = 'plenary.nvim-' .. _MODREV, } diff --git a/scripts/luarocks-upload.sh b/scripts/luarocks-upload.sh new file mode 100644 index 00000000..fae54a78 --- /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/plenary.nvim-$MODREV-1.rockspec" +cp "plenary.nvim-scm-1.rockspec" "$DEST_ROCKSPEC" +sed -i "s/'scm'/'$MODREV'/g" "$DEST_ROCKSPEC" +luarocks upload "$DEST_ROCKSPEC" --api-key="$LUAROCKS_API_KEY"