local utils = import 'utils.libjsonnet';

{
  jobs: {
    publish: {
      'runs-on': 'ubuntu-latest',
      steps: [
        {
          uses: 'actions/checkout@' + utils.githubLatestActionTag('actions', 'checkout'),
        },
        {
          uses: 'leafo/gh-actions-luarocks@' + utils.githubLatestActionTag('actions', 'checkout'),
        },
        {
          name: 'Upload package',
          run: 'luarocks upload --api-key=${{ secrets.LUAROCKS_API_KEY }} *.rockspec',
        },
      ],
    },
  },
  name: 'Publish to LuaRocks',
  on: {
    push: {
      tags: [
        'v*',
      ],
    },
  },
}
