chore: Bump version #1248
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 packages | |
on: | |
push: | |
branches: | |
- dev | |
- rc | |
- release | |
env: | |
REF: ${{ github.event.pull_request && github.head_ref || github.ref_name }} | |
jobs: | |
shared: | |
name: Publish shared | |
runs-on: ubuntu-latest | |
if: "contains(github.event.head_commit.message, 'Bump version')" | |
needs: test | |
defaults: | |
run: | |
working-directory: ./shared | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Check package version | |
id: pkgver | |
run: | | |
echo "::set-output name=local::$(node -p -e "require('./package.json').version")" | |
echo "::set-output name=remote::$(yarn info -s $(node -p -e "require('./package.json').name") version)" | |
- name: Publish package | |
if: ${{ steps.pkgver.outputs.local != steps.pkgver.outputs.remote }} | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_AUTH_TOKEN }} | |
package: ./shared/package.json | |
access: public | |
tag: ${{ env.REF == 'release' && 'latest' || env.REF }} | |
client: | |
name: Publish client | |
runs-on: ubuntu-latest | |
if: "contains(github.event.head_commit.message, 'Bump version')" | |
needs: test | |
defaults: | |
run: | |
working-directory: ./client | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Check package version | |
id: pkgver | |
run: | | |
echo "::set-output name=local::$(node -p -e "require('./package.json').version")" | |
echo "::set-output name=remote::$(yarn info -s $(node -p -e "require('./package.json').name") version)" | |
- name: Publish package | |
if: ${{ steps.pkgver.outputs.local != steps.pkgver.outputs.remote }} | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_AUTH_TOKEN }} | |
package: ./client/package.json | |
access: public | |
tag: ${{ env.REF == 'release' && 'latest' || env.REF }} | |
webview: | |
name: Publish webview | |
runs-on: ubuntu-latest | |
if: "contains(github.event.head_commit.message, 'Bump version')" | |
needs: test | |
defaults: | |
run: | |
working-directory: ./webview | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Check package version | |
id: pkgver | |
run: | | |
echo "::set-output name=local::$(node -p -e "require('./package.json').version")" | |
echo "::set-output name=remote::$(yarn info -s $(node -p -e "require('./package.json').name") version)" | |
- name: Publish package | |
if: ${{ steps.pkgver.outputs.local != steps.pkgver.outputs.remote }} | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_AUTH_TOKEN }} | |
package: ./webview/package.json | |
access: public | |
tag: ${{ env.REF == 'release' && 'latest' || env.REF }} | |
worker: | |
name: Publish worker | |
runs-on: ubuntu-latest | |
if: "contains(github.event.head_commit.message, 'Bump version')" | |
needs: test | |
defaults: | |
run: | |
working-directory: ./worker | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Check package version | |
id: pkgver | |
run: | | |
echo "::set-output name=local::$(node -p -e "require('./package.json').version")" | |
echo "::set-output name=remote::$(yarn info -s $(node -p -e "require('./package.json').name") version)" | |
- name: Publish package | |
if: ${{ steps.pkgver.outputs.local != steps.pkgver.outputs.remote }} | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_AUTH_TOKEN }} | |
package: ./worker/package.json | |
access: public | |
tag: ${{ env.REF == 'release' && 'latest' || env.REF }} | |
natives: | |
name: Publish natives | |
runs-on: ubuntu-latest | |
if: "contains(github.event.head_commit.message, 'Bump version')" | |
needs: test | |
defaults: | |
run: | |
working-directory: ./natives | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Set up .Net SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 5.0.x | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Check package version | |
id: pkgver | |
run: | | |
echo "::set-output name=local::$(node -p -e "require('./package.json').version")" | |
echo "::set-output name=remote::$(yarn info -s $(node -p -e "require('./package.json').name") version)" | |
- name: Checkout generator | |
if: ${{ steps.pkgver.outputs.local != steps.pkgver.outputs.remote }} | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
repository: altmp/altv-native-gen | |
ref: c40614e276bcbdd002cb4d78d6109c59d7884307 | |
path: ./gen | |
- name: Checkout nativedb | |
if: ${{ steps.pkgver.outputs.local != steps.pkgver.outputs.remote }} | |
run: | | |
mkdir "../nativedb" | |
curl "https://natives.altv.mp/natives" -A "AltPublicAgent" > "../nativedb/natives.json" | |
- name: Run generator | |
if: ${{ steps.pkgver.outputs.local != steps.pkgver.outputs.remote }} | |
run: dotnet run -p "../gen/Durty.AltV.NativesTypingsGenerator.Console" --disableHeader --nativesPath "../nativedb/natives.json" --outPath "./index.d.ts" --outIndent " " | |
- name: Commit changes | |
if: ${{ steps.pkgver.outputs.local != steps.pkgver.outputs.remote }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add "./index.d.ts" | |
git diff-index --quiet HEAD || git commit -m "chore: Update natives/index.d.ts" -m "Co-authored-by: $(git diff-tree ${{ github.sha }} --pretty='format:%an <%ae>' -s)" | |
- name: Push changes | |
if: ${{ steps.pkgver.outputs.local != steps.pkgver.outputs.remote }} | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ env.REF }} | |
- name: Publish package | |
if: ${{ steps.pkgver.outputs.local != steps.pkgver.outputs.remote }} | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_AUTH_TOKEN }} | |
package: ./natives/package.json | |
access: public | |
tag: ${{ env.REF == 'release' && 'latest' || env.REF }} | |
server: | |
name: Publish server | |
runs-on: ubuntu-latest | |
if: "contains(github.event.head_commit.message, 'Bump version')" | |
needs: test | |
defaults: | |
run: | |
working-directory: ./server | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Check package version | |
id: pkgver | |
run: | | |
echo "::set-output name=local::$(node -p -e "require('./package.json').version")" | |
echo "::set-output name=remote::$(yarn info -s $(node -p -e "require('./package.json').name") version)" | |
- name: Publish package | |
if: ${{ steps.pkgver.outputs.local != steps.pkgver.outputs.remote }} | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_AUTH_TOKEN }} | |
package: ./server/package.json | |
access: public | |
tag: ${{ env.REF == 'release' && 'latest' || env.REF }} | |
test: | |
name: Test changes | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Install dependencies | |
run: yarn install | |
- name: Test | |
run: yarn run test | |
- name: Lint | |
run: yarn run lint |