chunked_publish #235
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
steps: | |
- name: Checkout plugin repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ matrix.plugin.name }} | |
path: . | |
fetch-depth: 0 | |
- name: Get latest Tag | |
id: get-release | |
run: | | |
# Check for semver tags | |
TAGS="$(git for-each-ref --sort=authordate --format '%(refname)' refs/tags )" | |
if [[ -n "$TAGS" ]]; then | |
echo "Found tags:" | |
echo "$TAGS" | |
fi | |
TAG="$(git for-each-ref --sort=authordate --format '%(refname)' refs/tags | sed 's/refs\/tags\/\(.*\)/\1/' | grep -P '^[v]*[0-9]{1,}.[0-9]{1,}.[0-9]{1,}' | tail -n1)" | |
if [[ -z "$TAG" ]]; then | |
# Try without patch | |
TAG="$(git for-each-ref --sort=authordate --format '%(refname)' refs/tags | sed 's/refs\/tags\/\(.*\)/\1/' | grep -P '^[v]*[0-9]{1,}.[0-9]{1,}' | tail -n1)" | |
fi | |
if [[ -z "$TAG" ]]; then | |
# Try without minor | |
TAG="$(git for-each-ref --sort=authordate --format '%(refname)' refs/tags | sed 's/refs\/tags\/\(.*\)/\1/' | grep -P '^[v]*[0-9]{1,}' | tail -n1)" | |
fi | |
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: 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: Publish LuaRock | |
uses: nvim-neorocks/luarocks-tag-release@v5 | |
if: ${{ env.PUBLISHED_COUNT == '0' }} | |
env: | |
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} | |
with: | |
name: ${{ matrix.plugin.shorthand }} | |
dependencies: ${{ matrix.plugin.dependencies }} | |
version: ${{ env.RELEASE_VERSION }} | |
summary: ${{ matrix.plugin.summary }} | |
license: ${{ matrix.plugin.license }} | |
labels: neovim | |
test_interpreters: "" # Don't try to run busted tests | |
extra_luarocks_args: | | |
--namespace=neorocks |