Skip to content

Commit

Permalink
build: publish npm, luarocks, vsc packages
Browse files Browse the repository at this point in the history
The workflow only tests Lua 5.1 ~ 5.3, since busted packaged by Ubuntu does not
work with Lua 5.4.
  • Loading branch information
gudzpoz committed Apr 12, 2024
1 parent 7d57fe2 commit 80a0bdd
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 19 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish to NPM and LuaRocks

on:
workflow_dispatch:
push:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest
environment: Publish
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- run: |
rm -f ~/.npmrc
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8.5.0
run_install: false
- name: Setup PNPM Workspace
run: |
pnpm install
- name: Build Brocatel
run: |
pnpm build
- name: Test Brocatel
run: |
pnpm test
- name: Bundle Brocatel VM Runtime
run: |
pnpm bundle
- name: Install Lua Dependencies
run: |
sudo apt update
sudo apt install luarocks lua5.1 lua5.2 lua5.3 lua5.4 luajit lua-busted lua-check
- name: Publish Brocatel VM Runtime to LuaRocks
env:
ROCKS_TOKEN: ${{ secrets.ROCKS_TOKEN }}
run: |
cd vm
make clean
make busted-lua5.1 busted-lua5.2 busted-lua5.3 busted-luajit
make pack
luarocks upload --api-key="${ROCKS_TOKEN}" brocatel-*.rockspec
- name: Publish Brocatel Libraries to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set //registry.npmjs.org/:_authToken="${NODE_AUTH_TOKEN}"
pnpm run publish --no-git-checks
1 change: 1 addition & 0 deletions .vscode/brocatel.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"Lua.diagnostics.ignoredFiles": "Disable",
"Lua.workspace.ignoreDir": [
".vscode",
"dist",
"node_modules"
],
}
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Brocatel

[![NPM Version](https://img.shields.io/npm/v/%40brocatel%2Fmdc)](https://www.npmjs.com/package/@brocatel/mdc)
[![LuaRocks](https://img.shields.io/luarocks/v/gudzpoz/brocatel)](https://luarocks.org/modules/gudzpoz/brocatel)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/gudzpoz/brocatel/docs.yml?label=Documentation)](https://gudzpoz.github.io/brocatel/)

![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/gudzpoz/brocatel/vscode.yml?label=VS+Code+Extension)
[![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/gudzpoz.vscode-brocatel)](https://marketplace.visualstudio.com/items?itemName=gudzpoz.vscode-brocatel)
[![Open VSX Version](https://img.shields.io/open-vsx/v/gudzpoz/vscode-brocatel)](https://open-vsx.org/extension/gudzpoz/vscode-brocatel)

(By the way, you can also [run this README file interactively with Brocatel](https://gudzpoz.github.io/brocatel/playground.html?url=https://cdn.jsdelivr.net/gh/gudzpoz/brocatel@main/README.md).)

* What is Brocatel?
Expand Down
2 changes: 1 addition & 1 deletion md/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brocatel/md",
"version": "0.3.2",
"version": "0.3.3",
"description": "Custom Markdown syntax for brocatel scripts.",
"type": "module",
"main": "dist/brocatel-md.es.js",
Expand Down
2 changes: 1 addition & 1 deletion mdc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brocatel/mdc",
"version": "0.3.4",
"version": "0.3.5",
"description": "Markdown compiler for brocatel scripts.",
"type": "module",
"main": "dist/index.es.js",
Expand Down
2 changes: 1 addition & 1 deletion mde/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brocatel/mde",
"version": "0.3.3",
"version": "0.3.4",
"description": "A WYSIWYG-style editor for Brocatel Markdown.",
"type": "module",
"main": "dist/brocatel-mde.es.js",
Expand Down
2 changes: 2 additions & 0 deletions vm/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ node_modules/
brocatel.lua
!src/brocatel.lua
brocatel-*.rockspec
*.rock
*.rock.asc

# Python & Sphinx
__pycache__
Expand Down
14 changes: 13 additions & 1 deletion vm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,22 @@ rocks: $(SRC) brocatel.rockspec
cp brocatel.rockspec brocatel-${VERSION}.rockspec
luarocks --local make brocatel-${VERSION}.rockspec

pack: rocks
mkdir -p dist/brocatel-${VERSION}
mkdir -p /tmp/brocatel
rm -rf dist/brocatel-${VERSION}/*
cp -r doc dist/brocatel-${VERSION}/
cp -r src dist/brocatel-${VERSION}/
rm -f /tmp/brocatel/brocatel-${VERSION}.tar.gz
cd dist && tar -cvzf /tmp/brocatel/brocatel-${VERSION}.tar.gz brocatel-${VERSION} && cd ..

doc: $(SRC) $(DOCS)
mv src/brocatel.lua src/brocatel.lua.bak
sed -e 's/@module "brocatel"/@module brocatel/' src/brocatel.lua.bak > src/brocatel.lua
sphinx-build doc/ public/
mv src/brocatel.lua.bak src/brocatel.lua

.PHONY: doc rocks luacheck busted test bundle build all
clean:
rm -rf brocatel-*.rock brocatel-*.rock.asc brocatel-*.rockspec dist

.PHONY: doc rocks luacheck busted test bundle build all pack clean
31 changes: 17 additions & 14 deletions vm/brocatel.rockspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
rockspec_format = "3.0"
package = "brocatel"
version = "0.3.4-1"
version = "0.3.5-1"
source = {
url = "git+https://github.com/gudzpoz/brocatel.git",
url = "file:///tmp/brocatel/brocatel-0.3.5-1.tar.gz",
}
description = {
summary = "A VM that runs compiled brocatel scripts.",
Expand All @@ -14,20 +14,23 @@ description = {
}
build = {
type = "builtin",
install= {
lua = {
brocatel = "src/brocatel.lua",
["mdvm.env_api"] = "src/mdvm/env_api.lua",
["mdvm.history"] = "src/mdvm/history.lua",
["mdvm.lookup"] = "src/mdvm/lookup.lua",
["mdvm.savedata"] = "src/mdvm/savedata.lua",
["mdvm.stacked_env"] = "src/mdvm/stacked_env.lua",
["mdvm.table_path"] = "src/mdvm/table_path.lua",
["mdvm.utils"] = "src/mdvm/utils.lua",
["mdvm.vm"] = "src/mdvm/vm.lua",
},
modules = {
brocatel = "src/brocatel.lua",
["mdvm.env_api"] = "src/mdvm/env_api.lua",
["mdvm.history"] = "src/mdvm/history.lua",
["mdvm.lookup"] = "src/mdvm/lookup.lua",
["mdvm.savedata"] = "src/mdvm/savedata.lua",
["mdvm.stacked_env"] = "src/mdvm/stacked_env.lua",
["mdvm.table_path"] = "src/mdvm/table_path.lua",
["mdvm.utils"] = "src/mdvm/utils.lua",
["mdvm.vm"] = "src/mdvm/vm.lua",
},
install = {
bin = {
brocatel = "src/cli.lua",
},
},
copy_directories = {
"doc",
},
}
Binary file added vscode-brocatel/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion vscode-brocatel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
},
"displayName": "Brocatel Dev Tools",
"description": "Run and test Brocatel stories in VS Code",
"version": "0.0.2",
"icon": "./assets/favicon.png",
"version": "0.0.4",
"engines": {
"vscode": "^1.87.0",
"node": ">=16"
Expand Down

0 comments on commit 80a0bdd

Please sign in to comment.