Skip to content

Commit

Permalink
ci(rockspec): add luarocks-upload script and workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jan 11, 2023
1 parent 84ad602 commit 5be2d3a
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 3 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Release"
on:
push:
tags:
- '*'
jobs:
luarocks-upload:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v17
- uses: cachix/cachix-action@v10
with:
name: mrcjkb
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Luarocks upload
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
run: nix shell -c "luarocks-upload"
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add logging
### Fixed
- Packer init in minimal config for reproducing issues locally.
themes, etc. can be supported.

## [1.4.4] - 2022-12-20
### Fixed
Expand Down
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
shellFor = system: let
pkgs = pkgsFor system;
pre-commit-check = pre-commit-check-for system;
luarocks-upload = pkgs.callPackage ./nix/luarocks-upload.nix {inherit self;};
in
pkgs.mkShell {
name = "haskell-tools.nvim-shell";
Expand All @@ -94,7 +95,9 @@
zlib
alejandra
stylua
luarocks-upload
lua51Packages.luarocks
lua51Packages.dkjson
];
};
in {
Expand Down
3 changes: 1 addition & 2 deletions haskell-tools.nvim-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ description = {
}

dependencies = {
'lua >= 5.1, < 5.4',
'lua >= 5.1',
'nvim-lspconfig',
'plenary.nvim',
-- "telescope.nvim", -- TODO: Uncomment if telescope.nvim is added to luarocks
}

source = {
Expand Down
40 changes: 40 additions & 0 deletions nix/luarocks-upload.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
self,
pkgs,
lib,
stdenv,
...
}: let
tag = self.shortRev or null;
rev =
if tag != null
then "${tag}"
else "scm";
luarocks-package = stdenv.mkDerivation {
name = "haskell-tools-${rev}-rockspec";

src = self;

installPhase = ''
mkdir -p $out
cp haskell-tools.nvim-scm-1.rockspec $out/haskell-tools.nvim-${rev}-1.rockspec
'';
};
in
pkgs.writeShellApplication {
name = "luarocks-upload";
runtimeInputs = with pkgs; [
lua51Packages.luarocks
lua51Packages.dkjson # Needed for luarocks upload
luarocks-package
sd
git
];
text = lib.optionalString (tag != null) ''
rstmp=$(mktemp -d)
modrev=$(git describe --tags --always --first-parent)
cp -x "${luarocks-package}/haskell-tools.nvim-${rev}-1.rockspec" "$rstmp/haskell-tools.nvim-$modrev-1.rockspec"
sd "= 'scm'" "= '$modrev'" "$rstmp/haskell-tools.nvim-$modrev-1.rockspec"
luarocks upload "$rstmp/haskell-tools.nvim-$modrev-1.rockspec" --api-key="$LUAROCKS_API_KEY"
'';
}

0 comments on commit 5be2d3a

Please sign in to comment.