ci: update ci

This commit is contained in:
Afiq 2023-06-18 06:33:03 +08:00
parent 22e106a4f4
commit 7317415bdc
5 changed files with 52 additions and 1386 deletions

View File

@ -21,13 +21,8 @@ jobs:
- name: Setup Luarocks
uses: leafo/gh-actions-luarocks@v4
- name: Setup Bake
run: |
curl -LO https://github.com/hyperupcall/bake/raw/main/pkg/bin/bake
chmod +x bake
- name: Create release and upload to Luarocks
env:
LUAROCKS_API: "${{ secrets.LUAROCKS_API }}"
run: |
./bake release "${GITHUB_REF_NAME#v}"
lua scripts/makerel.lua

View File

@ -2,11 +2,11 @@ name: Generate Lua files
on:
workflow_dispatch:
schedule:
- cron: '0 12,0 * * *'
jobs:
gen-lua:
env:
PALETTE_COMMIT: df35c12c2fc6d2f7a68315a71fe85327199b883c
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
@ -28,13 +28,12 @@ jobs:
id: gen-lua
run: |
curl -Lo palette-porcelain.json \
https://github.com/catppuccin/palette/raw/main/palette-porcelain.json
"https://github.com/catppuccin/palette/raw/$PALETTE_COMMIT/palette-porcelain.json"
lua scripts/gen.lua
- name: Push changes
id: changes
run: |
mv palette-porcelain.json assets/palette-porcelain.json
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
@ -49,15 +48,13 @@ jobs:
env:
LATEST_TAG: ${{ steps.latest-tag.outputs.tag }}
run: |
if [[ a = b && "$(cat palette-porcelain.json)" = "$(cat assets/palette-porcelain.json)" ]]; then
raw="${LATEST_TAG#v}"
ver="${raw%-*}"
rev="${raw#*-}"
raw="${LATEST_TAG#v}"
ver="${raw%-*}"
rev="${raw#*-}"
(( rev = rev + 1 ))
(( rev = rev + 1 ))
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]"
git tag "v$ver-$rev"
git push origin "v$ver-$rev"
fi
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]"
git tag "v$ver-$rev"
git push origin "v$ver-$rev"

File diff suppressed because it is too large Load Diff

View File

@ -14,16 +14,16 @@ description = {
Usage:
-- Get Mocha palette
Get Mocha palette
local palette = require("catppuccin").mocha()
-- or
or
local palette = require("catppuccin.mocha")
-- -- Get the flavor name of currently used palette.
Get the flavor name of currently used palette.
=palette.name --> "mocha"
-- Get Blue color from Mocha palette.
Get Blue color from Mocha palette.
=palette.blue --> { hex: string; rgb: { number, number, number }; hsl: { number, number, number } }
See more on https://github.com/catppuccin/lua]],

36
scripts/makerel.lua Normal file
View File

@ -0,0 +1,36 @@
---@param cmd string
---@param silent? boolean
---@return boolean?
---@return string?
---@return integer?
local function async_exec(cmd, silent)
return coroutine.wrap(os.execute)(cmd..(silent and " >/dev/null 2>&1" or ""))
end
if not (async_exec("gh", true) and async_exec("luarocks", true)) then
error("Ensure gh and luarocks are installed in your machine!")
end
local ver, rev = assert(arg[1], "specify at least version (without revision)"), arg[2] or "1"
local version = ("%s-%s"):format(ver, rev)
local rs_name = ("catppuccin-%s.rockspec"):format(version)
print(ver, rev, version, rs_name)
assert(os.rename("catppuccin-dev-1.rockspec", rs_name))
local f_rockspec = assert(io.open(rs_name))
local cont_rockspec = f_rockspec:read("*a")
:gsub("dev%-1", version)
:gsub("@VERSION@", "v"..version)
:gsub("%-%- tag", " tag")
f_rockspec:close()
local fnew_rockspec = assert(io.open(rs_name, "w"))
fnew_rockspec:write(cont_rockspec)
fnew_rockspec:close()
if not async_exec("luarocks show lua-cjson", true) then
async_exec("luarocks install lua-cjson")
end
async_exec(([[luarocks upload --api-key="%s" %s]]):format(os.getenv("LUAROCKS_API"), rs_name))
async_exec(("gh release create v%s --generate-notes"):format(version))