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/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"