Skip to content

Commit 4706105

Browse files
committed
chore: publish to github packages
1 parent b0ead98 commit 4706105

3 files changed

Lines changed: 32 additions & 23 deletions

File tree

.github/workflows/release.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Build and Release Artifacts
22

33
permissions:
44
contents: write
5+
packages: write
56

67
on:
78
push:
@@ -28,11 +29,19 @@ jobs:
2829
2930
- name: Build wasm
3031
run: nix build ".#wasm"
31-
32-
- name: Copy wasm Result
32+
33+
- name: Publish built wasm package
3334
run: |
34-
cp -r ./result/main.wasm ${{ github.workspace }}/artifacts/mms.wasm
35-
cp -r ./result/wasm_exec.js ${{ github.workspace }}/artifacts/go_wasm_loader.js
35+
cd ./result/js
36+
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
37+
echo "@minecraftmetascript:registry=https://npm.pkg.github.com" >> .npmrc
38+
npm publish --access public
39+
40+
41+
# - name: Copy wasm Result
42+
# run: |
43+
# cp -r ./result/main.wasm ${{ github.workspace }}/artifacts/mms.wasm
44+
# cp -r ./result/wasm_exec.js ${{ github.workspace }}/artifacts/go_wasm_loader.js
3645

3746
- name: Get tag name
3847
id: get_tag

flake.nix

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@
1414
let
1515
pkgs = import nixpkgs { inherit system; };
1616
antlrBuild = pkgs.writeShellApplication {
17-
name = "antlr-build";
18-
runtimeInputs = [
19-
pkgs.antlr4
20-
pkgs.go
21-
];
22-
text = ''
23-
set -e
24-
src="./grammar"
25-
dst="./lang"
26-
${pkgs.antlr4}/bin/antlr4 -Dlanguage=Go $src/Main_Lexer.g4 -o $dst -package grammar;
27-
${pkgs.antlr4}/bin/antlr4 -Dlanguage=Go $src/Main_Parser.g4 -lib $dst/grammar -o $dst -package grammar;
28-
'';
29-
};
17+
name = "antlr-build";
18+
runtimeInputs = [
19+
pkgs.antlr4
20+
pkgs.go
21+
];
22+
text = ''
23+
set -e
24+
src="./grammar"
25+
dst="./lang"
26+
${pkgs.antlr4}/bin/antlr4 -Dlanguage=Go $src/Main_Lexer.g4 -o $dst -package grammar;
27+
${pkgs.antlr4}/bin/antlr4 -Dlanguage=Go $src/Main_Parser.g4 -lib $dst/grammar -o $dst -package grammar;
28+
'';
29+
};
3030
in
3131
{
3232
devShells.default = pkgs.mkShell {
33-
env = {
34-
GOROOT = "${pkgs.go}/share/go";
35-
};
36-
33+
env = {
34+
GOROOT = "${pkgs.go}/share/go";
35+
};
36+
3737
buildInputs = [
3838
pkgs.antlr4
3939
pkgs.go
@@ -74,7 +74,7 @@
7474
subPackages = [ "." ];
7575

7676
preBuild = ''
77-
${antlrBuild}/bin/antlr-build
77+
${antlrBuild}/bin/antlr-build
7878
'';
7979
};
8080

wasm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mms/wasm",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"keywords": [],
55
"author": "",
66
"license": "MIT",

0 commit comments

Comments
 (0)