From 7c08384e39f06e86b7b34d2f6cdc99f6d1e54233 Mon Sep 17 00:00:00 2001 From: "Matthieu C." <886074+teto@users.noreply.github.com> Date: Thu, 11 Jul 2024 14:54:07 +0200 Subject: [PATCH] ci: fixed workflows by converting json list into multiline string ... as expected by luarocks-tag-release - doc: updated README ci: adding test over selected plugins --- .github/workflows/pr.yml | 51 +++++++++++++++++++++++++++++-- .github/workflows/publish-dev.yml | 12 +++++++- .github/workflows/publish.yml | 12 +++++++- README.md | 2 +- 4 files changed, 72 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b28a788..0b7baed 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -8,8 +8,15 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - deps: [ [ "toto", "toto2" ], ["tata", "tata2" ] ] - # if: github.event.pull_request.draft == false + plugin: [ + { + "name": "startup-nvim/startup.nvim", + "shorthand": "startup.nvim", + "license": "GPL-2.0", + "summary": "A highly configurable neovim startup screen", + "dependencies": ["telescope.nvim", "plenary.nvim"] + } + ] steps: - name: Install Lua @@ -21,3 +28,43 @@ jobs: - name: test concat run: | echo ${{ join (matrix.deps, '\n')}} + + - name: Checkout plugin repository + uses: actions/checkout@v4 + with: + repository: ${{ matrix.plugin.name }} + ref: ${{ matrix.plugin.ref }} + path: . + + - run: | + echo "GITHUB_REPOSITORY_OVERRIDE=${{ matrix.plugin.name }}" >> $GITHUB_ENV + echo "GITHUB_SHA_OVERRIDE=$(git rev-parse HEAD)" >> $GITHUB_ENV + + - name: Convert JSON list to multiline string + id: convert + run: | + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings + { + echo "multiline<> "$GITHUB_OUTPUT" + + - name: Publish Development LuaRock + uses: nvim-neorocks/luarocks-tag-release@v7 + env: + LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} + with: + name: ${{ matrix.plugin.shorthand }} + dependencies: ${{ steps.convert.outputs.multiline }} + version: "scm" + summary: ${{ matrix.plugin.summary }} + license: ${{ matrix.plugin.license }} + labels: neovim + copy_directories: | + {{ neovim.plugin.dirs }} + ${{ matrix.plugin.extra_directories }} + extra_luarocks_args: | + --namespace=neorocks + --force + --dev diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index 72d69ea..7f6d956 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -25,13 +25,23 @@ jobs: echo "GITHUB_REPOSITORY_OVERRIDE=${{ matrix.plugin.name }}" >> $GITHUB_ENV echo "GITHUB_SHA_OVERRIDE=$(git rev-parse HEAD)" >> $GITHUB_ENV + - name: Convert JSON list to multiline string + id: convert + run: | + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings + { + echo "multiline<> "$GITHUB_OUTPUT" + - name: Publish Development LuaRock uses: nvim-neorocks/luarocks-tag-release@v7 env: LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} with: name: ${{ matrix.plugin.shorthand }} - dependencies: ${{ join(matrix.plugin.dependencies, '\n') }} + dependencies: ${{ steps.convert.outputs.multiline }} version: "scm" summary: ${{ matrix.plugin.summary }} license: ${{ matrix.plugin.license }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 36e0712..ccfd32e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -71,6 +71,16 @@ jobs: run: | echo "PUBLISHED_COUNT=$(luarocks --only-server=https://luarocks.org/manifests/neorocks search ${{ matrix.plugin.shorthand }} ${{ env.RELEASE_VERSION }} --porcelain | wc -l)" >> $GITHUB_ENV + - name: Convert JSON list to multiline string + id: convert + run: | + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings + { + echo "multiline<> "$GITHUB_OUTPUT" + - name: Publish LuaRock uses: nvim-neorocks/luarocks-tag-release@v7 if: ${{ env.PUBLISHED_COUNT == '0' }} @@ -78,7 +88,7 @@ jobs: LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} with: name: ${{ matrix.plugin.shorthand }} - dependencies: ${{ join(matrix.plugin.dependencies, '\n') }} + dependencies: ${{ steps.convert.outputs.multiline }} version: ${{ env.RELEASE_VERSION }} summary: ${{ matrix.plugin.summary }} license: ${{ matrix.plugin.license }} diff --git a/README.md b/README.md index 70179ba..57efd52 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ which uses the chunk it receives as the input for a matrix build. - `name`: owner/repo (GitHub) - `shorthand`: The name of the plugin (will be the lua rock name) -- `dependencies`: Plugin dependencies, separated with newline `\n` characters +- `dependencies`: Plugin dependencies, a list of luarocks plugins - `summary`: Short description of the plugin - `license`: The license SPDX - `extra_directories`: (optional) Extra directories to copy, separated by `\n`,