Skip to content

pushing the version to git #53

pushing the version to git

pushing the version to git #53

name: Generate and Publish Client Libraries
on:
push:
branches: [main]
jobs:
generate-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "16" # Or your preferred Node.js version
registry-url: https://registry.npmjs.org/
scope: "@eyeamkd"
- name: Install Dependencies
run: npm install
# - name: Validate Schemas
# run: node validate-schemas.js # Assuming you have a validation script
- name: Generate TypeScript Client
run: node ./clients/typescript/generate.js
- name: Set Git User Information
run: |
git config --global user.email "${{ secrets.SCHEMACHER_GIT_EMAIL }}"
git config --global user.name "${{ secrets.SCHEMACHER_GIT_NAME }}"
- name: Authenticate with GitHub
env:
GITHUB_TOKEN: ${{ secrets.G_TOKEN }}
run: |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/eyeamkd/schemacher.git
- name: Generate and Publish TypeScript Client
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd clients/typescript
node generate.js # Generate the files (including package.json)
cd ../../package
if npm view @eyeamkd/type-registry version >/dev/null 2>&1; then
npm version patch
npm publish --access public # Publish inside the if block
else
npm publish --access public # Publish initial version if it doesn't exist
fi
cd ../ && rm -rf package
git add . && git commit -m "Update TypeScript Client" && git push