feat(sdk): Update sdk with latest changes #40
Workflow file for this run
This file contains hidden or 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: checks | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, labeled, unlabeled] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| version-bump: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| fetch-depth: 0 | |
| - run: corepack enable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: | | |
| yarn install | |
| - name: running codemod | |
| run: yarn ts-node codemod/index.ts | |
| - name: Get current version from main | |
| run: | | |
| git fetch origin main | |
| MAIN_VERSION=$(git show origin/main:package.json | grep '"version":' | cut -d'"' -f4) | |
| echo "MAIN_VERSION=$MAIN_VERSION" >> $GITHUB_ENV | |
| - name: Determine version bump type | |
| id: bump-type | |
| run: | | |
| if [[ $(gh pr view ${{ github.event.pull_request.number }} --json labels -q '.labels[].name' | grep -c "major") -gt 0 ]]; then | |
| echo "TYPE=major" >> $GITHUB_OUTPUT | |
| elif [[ $(gh pr view ${{ github.event.pull_request.number }} --json labels -q '.labels[].name' | grep -c "minor") -gt 0 ]]; then | |
| echo "TYPE=minor" >> $GITHUB_OUTPUT | |
| elif [[ $(gh pr view ${{ github.event.pull_request.number }} --json labels -q '.labels[].name' | grep -c "patch") -gt 0 ]]; then | |
| echo "TYPE=patch" >> $GITHUB_OUTPUT | |
| else | |
| echo "TYPE=none" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Bump version | |
| if: steps.bump-type.outputs.TYPE != 'none' | |
| continue-on-error: true | |
| run: | | |
| VERSION_PARTS=(${MAIN_VERSION//./ }) | |
| MAJOR=${VERSION_PARTS[0]} | |
| MINOR=${VERSION_PARTS[1]} | |
| PATCH=${VERSION_PARTS[2]} | |
| if [ "${{ steps.bump-type.outputs.TYPE }}" == "major" ]; then | |
| NEW_VERSION="$((MAJOR + 1)).0.0" | |
| elif [ "${{ steps.bump-type.outputs.TYPE }}" == "minor" ]; then | |
| NEW_VERSION="${MAJOR}.$((MINOR + 1)).0" | |
| else | |
| NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))" | |
| fi | |
| npm version $NEW_VERSION --no-git-tag-version | |
| - name: Commit changes | |
| continue-on-error: true | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add . | |
| git commit -m "chore: update dependencies and version bump" || echo "No changes to commit" | |
| git push |