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
name: Publish Native NPM | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '.github/workflows/publish-native-ts.yml' | |
- 'src/Bannerlord.ModuleManager.Native/**.*' | |
- 'src/Bannerlord.ModuleManager.Native.TypeScript/**.*' | |
workflow_dispatch: | |
jobs: | |
publish: | |
name: Publish on NPM and GPR | |
runs-on: windows-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@master | |
with: | |
dotnet-version: 8.x.x | |
- run: dotnet publish -r win-x64 --self-contained -c Debug src/Bannerlord.ModuleManager.Native | |
- run: dotnet publish -r win-x64 --self-contained -c Release src/Bannerlord.ModuleManager.Native | |
- run: dotnet test test/Bannerlord.ModuleManager.Native.Tests -c Debug | |
- run: dotnet test test/Bannerlord.ModuleManager.Native.Tests -c Release | |
- uses: actions/[email protected] | |
with: | |
node-version: 16 | |
cache: 'npm' | |
cache-dependency-path: src/Bannerlord.ModuleManager.Native.TypeScript/package-lock.json | |
- run: | | |
cd ./src/Bannerlord.ModuleManager.Native.TypeScript && ` | |
npm version $(node -p "require('./package.json').version = ` | |
require('./package.json').version.split('.')[0]+'.' + ` | |
require('./package.json').version.split('.')[1]+'.' + ` | |
$(git rev-list --no-merges --count master)") --no-git-tag-version --allow-same-version; | |
- run: cd ./src/Bannerlord.ModuleManager.Native.TypeScript && npm ci | |
- run: cd ./src/Bannerlord.ModuleManager.Native.TypeScript && npm run build | |
- run: cd ./src/Bannerlord.ModuleManager.Native.TypeScript && npm run test | |
- uses: actions/[email protected] | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
scope: '@butr' | |
- run: cd ./src/Bannerlord.ModuleManager.Native.TypeScript && npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.PUBLISH_NPM_TOKEN}} | |
- uses: actions/[email protected] | |
with: | |
node-version: 16 | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@butr' | |
- run: cd ./src/Bannerlord.ModuleManager.Native.TypeScript && npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.PUBLISH_GITHUB_TOKEN}} |