Publish server (#56)

* publish server

* package name

* test publish

* publish server

* publish server

* publish server

* publish server

* publish server

* publish server
This commit is contained in:
Gregor Zeitlinger 2024-09-29 13:22:34 +02:00 • committed by GitHub
parent c14f97121a
commit 22b52c7c9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 119 additions and 9 deletions

View file

@ -1,4 +1,4 @@
name: Rust
name: Check All
on:
push:

28
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,28 @@
name: Server - Release
on:
push:
tags:
- "v*.*.*"
env:
node_version: 14
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ env.node_version }}
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED
registry-url: "https://registry.npmjs.org"
- uses: jetli/wasm-pack-action@v0.4.0
with:
version: 'latest'
# see https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
- run: ./scripts/publish-server.sh ${{ github.event.release.tag_name }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View file

@ -116,6 +116,51 @@ diff --git a/apps/api/app/resources.ts b/apps/api/app/resources.ts
console.log('received message from controller', event.data.type, JSON.parse(JSON.stringify(event.data)));
switch (event.data.type) {
```
GameInfo.json (for now)
```json
{
"_id": {
"game": "clash",
"version": 1
},
"description": "Clash of Cultures",
"engine": {
"package": {
"name": "@boardgamers/clash-server",
"version": "*"
},
"entryPoint": "server.js"
},
"expansions": [],
"label": "Clash of Cultures",
"meta": {
"public": true,
"needOwnership": true
},
"options": [],
"players": [
2,
3,
4
],
"preferences": [],
"rules": "",
"viewer": {
"url": "http://localhost:4000/client.js",
"topLevelVariable": "clash",
"dependencies": {
"scripts": [],
"stylesheets": []
},
"replayable": true,
"alternate": null,
"settings": []
}
}
```
## Docs

6
RELEASING.md Normal file
View file

@ -0,0 +1,6 @@
# Releasing
1. Go to https://github.com/boardgamers/clash/releases/new
2. Click on "Choose a tag", enter the tag name (e.g. `v0.1.0`), and click "Create a new tag".
3. Click on "Generate release notes" to auto-generate the release notes based on the commits since the last release.
4. Click on "Publish release".

View file

@ -3,6 +3,10 @@ name = "client"
version = "0.1.0"
edition = "2021"
default-run = "local_client"
license = "MIT"
repository = "git@github.com:boardgamers/clash.git"
homepage = "https://www.boardgamers.space/"
description = "A client for Clash of Cultures"
[profile.dev]
debug = true

View file

@ -1,14 +1,13 @@
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
filename: 'client.js',
path: path.resolve(__dirname, 'dist'),
},
resolve: {
entry: './src/index.js', output: {
filename: 'client.js', path: path.resolve(__dirname, 'dist'),
}, resolve: {
fallback: {"events": require.resolve("events/")}
}
}, optimization: {
minimize: true
},
};

View file

@ -1,7 +1,9 @@
#!/usr/bin/env bash
set -e
set -euo pipefail
pushd server
wasm-pack build --target nodejs
popd
echo "Done!"

21
scripts/publish-server.sh Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
VERSION=$1
if [ -z "$VERSION" ]; then
echo "Usage: $0 <version>"
exit 1
fi
echo "Building server..."
./scripts/build-wasm-server.sh
echo "Publishing server..."
pushd server
sed -i 's#"name": "server"#"name": "@boardgamers/clash-server"#' pkg/package.json
sed -i "s#\"version\": \"0.1.0\"#\"version\": \"$VERSION\"#" pkg/package.json
wasm-pack publish --access public
popd
echo "Done!"

View file

@ -2,6 +2,11 @@
name = "server"
version = "0.1.0"
edition = "2021"
license = "MIT"
repository = "git@github.com:boardgamers/clash.git"
homepage = "https://www.boardgamers.space/"
description = "A server for Clash of Cultures"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html