diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000..fd64691 --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,44 @@ +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: 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 + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 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"