Release Production (SDK) #9
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: Release Production (SDK) | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version_type: | ||
| description: 'Version bump type' | ||
| required: true | ||
| default: 'patch' | ||
| type: choice | ||
| options: | ||
| - patch | ||
| - minor | ||
| - major | ||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
| jobs: | ||
| # First job: Prepare production release | ||
| prepare-and-commit-prod: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| new_version: ${{ steps.bump_version.outputs.new_version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| - uses: ./.github/actions/setup-project | ||
| - name: Calculate and update production version | ||
| id: bump_version | ||
| run: | | ||
| cd sdk | ||
| # Get current version and bump it | ||
| CURRENT_VERSION=$(bun -e "console.log(require('./package.json').version)") | ||
| echo "Current version: $CURRENT_VERSION" | ||
| # Bump version using Node.js semver since npm doesn't work with workspace: protocol | ||
| NEW_VERSION=$(node -e " | ||
| const fs = require('fs'); | ||
| const semver = require('semver'); | ||
| const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); | ||
| const newVersion = semver.inc(pkg.version, '${{ inputs.version_type }}'); | ||
| pkg.version = newVersion; | ||
| fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\\n'); | ||
| console.log(newVersion); | ||
| ") | ||
| echo "New production version: $NEW_VERSION" | ||
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | ||
| git stash | ||
| build-and-publish-sdk: | ||
| needs: prepare-and-commit-prod | ||
| uses: ./.github/workflows/sdk-release-build.yml | ||
| with: | ||
| new-version: ${{ needs.prepare-and-commit-prod.outputs.new_version }} | ||
| artifact-name: updated-sdk-package | ||
| checkout-ref: ${{ github.sha }} | ||
| env-overrides: '{"NEXT_PUBLIC_CODEBUFF_BACKEND_URL": "manicode-backend.onrender.com", "NEXT_PUBLIC_CB_ENVIRONMENT": "prod"}' | ||
|
Check failure on line 65 in .github/workflows/sdk-release-prod.yml
|
||
| secrets: inherit | ||
| push-to-git: | ||
| runs-on: ubuntu-latest | ||
| needs: build-and-publish-sdk | ||
| outputs: | ||
| new_version: ${{ steps.bump_version.outputs.new_version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| - uses: ./.github/actions/setup-project | ||
| - name: Configure git | ||
| run: | | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
| - name: Commit and push version bump | ||
| run: | | ||
| git pull --rebase origin main | ||
| git stash pop | ||
| git add sdk/package.json | ||
| git commit -m "Bump SDK version to ${{ steps.bump_version.outputs.new_version }}" | ||
| git push | ||