Skip to content

chunked_publish

chunked_publish #4327

Workflow file for this run

name: Publish semver tags to LuaRocks
on:
repository_dispatch:
types: [chunked_publish]
jobs:
publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10 # Don't DDOS the luarocks servers
matrix:
plugin: ${{ github.event.client_payload.plugins }}
name: Pushing ${{ matrix.plugin.shorthand }}
steps:
- name: Install tree-sitter CLI
uses: baptiste0928/cargo-install@v3
with:
crate: tree-sitter-cli
- uses: actions/setup-node@v4
if: ${{ matrix.parsers.install_info.generate }}
- name: Install C/C++ Compiler
uses: rlalik/setup-cpp-compiler@master
with:
compiler: clang-latest
- name: Checkout plugin repository
uses: actions/checkout@v4
with:
repository: ${{ matrix.plugin.name }}
path: .
fetch-depth: 0
- uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: nightly
- name: checkout NURR scripts
uses: actions/checkout@v4
with:
sparse-checkout: |
scripts
path: nurr
- name: Get latest Tag
id: get-release
run: |
# Check for semver tags
TAG="$(./nurr/scripts/echo_latest_tag_version.lua)"
if [[ -n "$TAG" ]]; then
echo "Found $TAG"
git checkout $TAG
VERSION=$(echo "$TAG" | sed 's/v\(.*\)/\1/')
echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_ENV
echo "GITHUB_REF_TYPE_OVERRIDE=tag" >> $GITHUB_ENV
echo "GITHUB_REF_NAME_OVERRIDE=$TAG" >> $GITHUB_ENV
echo "GITHUB_REPOSITORY_OVERRIDE=${{ matrix.plugin.name }}" >> $GITHUB_ENV
else
echo "PUBLISHED_COUNT=NOTHING" >> $GITHUB_ENV
fi
- name: Cleanup NURR scripts
run: |
rm -r nurr
- name: Install Lua
if: ${{ env.RELEASE_VERSION != '' }}
uses: leso-kn/gh-actions-lua@master
with:
luaVersion: "5.1"
- name: Install Luarocks
if: ${{ env.RELEASE_VERSION != '' }}
uses: hishamhm/gh-actions-luarocks@master
- name: Print plugin directories and environment
if: ${{ env.RELEASE_VERSION != '' }}
run: |
ls -a
printenv
- if: ${{ env.RELEASE_VERSION != '' }}
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<<EOF"
echo -e "${{ join(matrix.plugin.dependencies, '\n') }}"
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Get resources
uses: actions/checkout@v4
with:
sparse-checkout: |
resources
path: nurr
- name: Publish LuaRock
uses: nvim-neorocks/luarocks-tag-release@v7
if: ${{ env.PUBLISHED_COUNT == '0' }}
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
with:
name: ${{ matrix.plugin.shorthand }}
dependencies: ${{ steps.convert.outputs.multiline }}
version: ${{ env.RELEASE_VERSION }}
summary: ${{ matrix.plugin.summary }}
license: ${{ matrix.plugin.license }}
labels: neovim
copy_directories: |
{{ neovim.plugin.dirs }}
${{ matrix.plugin.extra_directories }}
extra_luarocks_args: |
--namespace=neorocks
template: ${{ matrix.plugin.rockspec_template }}