Skip to content

Commit

Permalink
github workflows for typescript language bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro100 committed Apr 22, 2024
1 parent 092e301 commit 12fb18a
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/typescript_package_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: GBFS Typescript Language Bindings - Publish

on:
push:
branches:
- master

jobs:
build-publish:
name: build-publish-job
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./models/typescript

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: yarn

- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

42 changes: 42 additions & 0 deletions .github/workflows/typescript_pr_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: GBFS Typescript Language Bindings - PR Check
on:
pull_request:
branches:
- main
paths:
- "models/typescript/**"

jobs:
check-versions:
name: check-version-job
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: master

- name: Get current local version
id: get_current_local_version
run: echo "version=$(jq -r '.version' models/typescript/package.json)" >> $GITHUB_OUTPUT

- name: Get version on master
id: get_master_version
run: echo "master-version=$(jq -r '.version' jq -r '.version' master/models/typescript/package.json)" >> $GITHUB_OUTPUT

- name: Compare versions
run: |
current_version="${{ steps.get_current_local_version.outputs.version }}"
master_version="${{ steps.get_master_version.outputs.master-version }}"
if [ "$current_version" != "$master_version" ]; then
echo "Versions are different:"
echo "Current version: $current_version"
echo "Version on master: $master_version"
else
echo "Versions are the same: $current_version"
echo "Please update the package.json version so that your changes will be published."
exit 1
fi

0 comments on commit 12fb18a

Please sign in to comment.