Skip to content

Update code and publish #168

Update code and publish

Update code and publish #168

name: Update code and publish
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
jobs:
generate:
name: Update code and publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '22'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Install dependencies
run: npm ci
- name: Generate code
run: npm run generate
- name: Check for changes
id: git-check
run: |
git diff --quiet || echo "changes=true" >> $GITHUB_OUTPUT
- name: Commit changes
if: steps.git-check.outputs.changes == 'true'
run: |
git config --local user.email "martin.kopecek@smallhill.cz"
git config --local user.name "Martin Kopeček"
git add .
git commit -m "feat(sdk): update generated SDK"
npm run release:patch
- name: Build package
if: steps.git-check.outputs.changes == 'true'
run: npm run build
- name: Publish to NPM
if: steps.git-check.outputs.changes == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}