-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b41de93
commit 268b422
Showing
2 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"name": "@barinbritva/game-engines-sdk", | ||
"private": true, | ||
"engines": { | ||
"node": ">=18.0.0", | ||
"npm": ">=9.0.0" | ||
|