diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000..43d4e08 --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,53 @@ +name: Publish to NPM + +on: + push: + tags: + # package-major.minor.patch - required + # -beta.build - optional + - '*-*.*.*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - id: get-package + run: | + PACKAGE_NAME=$(echo ${GITHUB_REF#refs/tags/} | cut -d- -f1) + ALLOWED_PACKAGES=("phaser") # Add more package names if needed + if [[ " ${ALLOWED_PACKAGES[@]} " =~ " ${PACKAGE_NAME} " ]]; then + echo "::set-output name=package::${PACKAGE_NAME}" + else + echo "Invalid package name ${PACKAGE_NAME}." + exit 1 + fi + shell: bash + + - uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: Check version + run: | + TAG_VERSION=$(echo ${GITHUB_REF#refs/tags/${{ steps.get-package.outputs.package }}-}) + PACKAGE_VERSION=$(node -p "require('./packages/${{ steps.get-package.outputs.package }}/package.json').version") + if [[ "${TAG_VERSION}" != "${PACKAGE_VERSION}" ]]; then + echo "Tag version ${TAG_VERSION} does not match package version ${PACKAGE_VERSION}." + exit 1 + fi + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build --workspace @barinbritva/${{ steps.get-package.outputs.package }}-sdk + + - name: Publish + run: cd packages/${{ steps.get-package.outputs.package }} && npm publish --access=public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index 8edaebe..4d62fd5 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# gamefi-sdk +# game-engines-sdk -TON bindings and utilities for game engines: +TON blockchain bindings and utilities for game engines: * Phaser.io * Cocos2d (coming soon) # Getting started Installation: ```sh -npm install --save @ton-community/gamefi-phaser +npm install --save @barinbritva/phaser-sdk ``` Creating GameFi instance: diff --git a/package.json b/package.json index cf2f401..4e3ab40 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "name": "@barinbritva/game-engines-sdk", - "private": true, "engines": { "node": ">=18.0.0", "npm": ">=9.0.0" diff --git a/packages/phaser/README.md b/packages/phaser/README.md new file mode 100644 index 0000000..0e4d20a --- /dev/null +++ b/packages/phaser/README.md @@ -0,0 +1,7 @@ +# phaser-sdk + +TON blockchain bindings and utilities for [Phaser.io](https://phaser.io/) game engine. + +# Documentation + +Please read the documentation in the official [repository](https://github.com/barinbritva/game-engines-sdk).