Skip to content

Commit

Permalink
🐛 luarocks auto-generate script
Browse files Browse the repository at this point in the history
Having "/" in the start of path breaks luarocks installation.

closes #115
  • Loading branch information
kkharji committed Sep 9, 2021
1 parent ca8233f commit 43f5e0c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 28 deletions.
43 changes: 19 additions & 24 deletions .github/chglog/CHANGELOG.release.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
{{- $repourl := $.Info.RepositoryURL -}}

{{ range .Versions }}
{{ if eq .Tag.Name "CIGTAG" }}
{{ range .CommitGroups -}}
## {{ .Title }}

{{ range .Commits -}}
{{- /** Remove markdown urls when there's a pull request linked and replace it with a tag **/ -}}
{{- $subject := (regexReplaceAll `URL` (regexReplaceAll `\[(.*)(\d\d)\]\(.*?\)` .Subject "<a href=\"URL/pull/${2}\">${1}${2}</a>") $repourl) -}}
{{- /** Filter out refs mentioned in the title **/ -}}
{{- $list := (list) -}}
{{- range $idx, $ref := .Refs -}}
{{- if not (regexMatch $ref.Ref $subject) -}}
{{ $list = append $list $ref }}
{{- end -}}
{{- end -}}
{{- /** end custom varaibles **/ -}}
{{- /** Remove markdown urls when there's a pull request linked and replace it with a tag **/ -}}
{{- $subject := (regexReplaceAll `URL` (regexReplaceAll `\[(.*)(\d\d)\]\(.*?\)` .Subject "<a href=\"URL/pull/${2}\">${1}${2}</a>") $repourl) -}}
{{- /** Filter out refs mentioned in the title **/ -}}
{{- $list := (list) -}}
{{- range $idx, $ref := .Refs -}}
{{- if not (regexMatch $ref.Ref $subject) -}}
{{ $list = append $list $ref }}
{{- end -}}
{{- end -}}
{{- /** end custom variables **/ -}}

{{ if .TrimmedBody -}}<dl><dd><details><summary>{{ else -}}- {{ end -}}
<a href="{{$repourl}}/commit/{{.Hash.Long}}"><tt>{{.Hash.Short}}</tt></a> {{ $subject }}
{{- if $list -}}
{{ printf " %s " "(closes"}}
{{- range $idx, $ref := $list -}}{{ if $idx }}, {{ end -}}
<a href="{{ $repourl }}/issues/{{ $ref.Ref}}"> #{{ $ref.Ref}}</a>{{ end }})
{{- end -}}
<a href="{{$repourl}}/commit/{{.Hash.Long}}"><tt>{{.Hash.Short}}</tt></a> {{ $subject }}
{{- if $list -}}
{{ printf " %s " "(closes"}}
{{- range $idx, $ref := $list -}}{{ if $idx }}, {{ end -}}
<a href="{{ $repourl }}/issues/{{ $ref.Ref}}"> #{{ $ref.Ref}}</a>{{ end }})
{{- end -}}
{{ if .TrimmedBody -}}</summary>{{ printf "\n\n%s\n\n" .TrimmedBody }}</details></dd></dl>{{ end }}

{{ end }}
{{ end }}

{{- if .RevertCommits -}}
### Reverts

{{ range .RevertCommits -}}
* {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
Expand All @@ -45,3 +39,4 @@
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
16 changes: 13 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,17 @@ jobs:
-
name: Install required utils
run: |
apt-get update
apt-get -y install luarocks
go get github.com/git-chglog/git-chglog/cmd/git-chglog
apt-get update -y lua sudo unzip
apt-get -y install build-essential libreadline-dev
wget https://luarocks.org/releases/luarocks-3.7.0.tar.gz
wget https://luarocks.org/releases/luarocks-3.3.1.tar.gz
tar zxpf luarocks-3.3.1.tar.gz
cd luarocks-3.3.1
./configure --with-lua-include=/usr/local/include
make; make install
cd -
echo $(luarocks --version)
-
name: Setup Environment
run: |
Expand All @@ -49,6 +57,8 @@ jobs:
-
name: Generate changelog
run: |
sed -i "s/CIGTAG/${{ steps.tag.outputs.TAG }}/g" .github/chglog/CHANGELOG.release.md
$(go env GOPATH)/bin/git-chglog \
-c .github/chglog/config.yml \
-t .github/chglog/CHANGELOG.release.md \
Expand All @@ -59,7 +69,7 @@ jobs:
run: |
export GTAG=${{ steps.tag.outputs.TAG }}
export PATH="${PWD}/build/:${PATH}"
make genluarock
make gen_luarock
-
name: Update version in files
run: |
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen_rockspec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = c(dependencies)

--- Format modules ----------------------------------------
for _, v in ipairs(scandir(cwd, { search_pattern = "/lua/sqlite/[^examples]" })) do
local path = v:gsub(cwd, "")
local path = v:gsub(cwd .. "/", "")
local module = path:gsub("/", "%."):gsub(".lua.(.-).lua", "%1")
modules[module] = path
end
Expand Down

0 comments on commit 43f5e0c

Please sign in to comment.