Skip to content

Improves README and documentation #64

Improves README and documentation

Improves README and documentation #64

name: test-and-publish
on:
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
jobs:
tests-51:
uses: ./.github/workflows/run-tests.yml
with:
lua-version: 5.1
tests-52:
uses: ./.github/workflows/run-tests.yml
with:
lua-version: 5.2
tests-53:
uses: ./.github/workflows/run-tests.yml
with:
lua-version: 5.3
tests-54:
uses: ./.github/workflows/run-tests.yml
with:
lua-version: 5.4
publish:
name: Publish to LuaRocks
runs-on: ubuntu-latest
needs: [tests-51, tests-52, tests-53, tests-54]
steps:
- uses: actions/checkout@main
- name: Install Lua/LuaJIT
uses: leafo/gh-actions-lua@v10.0.0
with:
luaVersion: 5.4
- name: Install LuaRocks
uses: leafo/gh-actions-luarocks@v4.3.0
- name: Install dkjson
# Publishing to LuaRocks requires a JSON library such as cjson, dkjson or json.
run: |
luarocks install dkjson
- name: Publish scm version to LuaRocks
if: ${{ github.ref == 'refs/heads/main' }}
run: |
luarocks upload lazylualinq-scm-1.rockspec --force --api-key=${{ secrets.LUAROCKS_API_KEY }}
- name: Extract version from tag
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
id: extract-version
run: |
echo "VERSION=$(echo ${{ github.ref_name }} | cut -c 2-)" >> "$GITHUB_OUTPUT"
- name: Fail run if there's no valid rockspec
if: ${{ startsWith(github.ref, 'refs/tags/v') && hashFiles(format('lazylualinq-{0}-1.rockspec', steps.extract-version.outputs.VERSION)) == '' }}
run: |
exit 1
- name: Publish release version to LuaRocks
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
luarocks upload lazylualinq-${{ steps.extract-version.outputs.VERSION }}-1.rockspec --api-key=${{ secrets.LUAROCKS_API_KEY }}