Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish server #56

Merged
merged 9 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml → .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust
name: Check All

on:
push:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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 }}
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -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".
4 changes: 4 additions & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name = "client"
version = "0.1.0"
edition = "2021"
default-run = "local_client"
license = "MIT"
repository = "[email protected]:boardgamers/clash.git"
homepage = "https://www.boardgamers.space/"
description = "A client for Clash of Cultures"

[profile.dev]
debug = true
Expand Down
13 changes: 6 additions & 7 deletions client/remote_client/webpack.config.js
Original file line number Diff line number Diff line change
@@ -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
},
};


4 changes: 3 additions & 1 deletion server/build-wasm.sh → scripts/build-wasm-server.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env bash

set -e
set -euo pipefail

pushd server
wasm-pack build --target nodejs
popd

echo "Done!"
21 changes: 21 additions & 0 deletions scripts/publish-server.sh
Original file line number Diff line number Diff line change
@@ -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!"
5 changes: 5 additions & 0 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
name = "server"
version = "0.1.0"
edition = "2021"
license = "MIT"
repository = "[email protected]: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

Expand Down
Loading