Release from main by @liyaka #211
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
| # Internal release | |
| name: "Release" | |
| run-name: "Release from ${{github.ref_name}} by @${{ github.actor }}" | |
| on: | |
| workflow_dispatch: | |
| workflow_call: # in order to make this action been called from outside | |
| outputs: | |
| version: | |
| description: 'The release version' | |
| value: ${{ jobs.set-version.outputs.version }} | |
| jobs: | |
| set-version: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.1 | |
| - name: Set version | |
| id: version | |
| run: | | |
| echo "version=$(cat version.txt)" | tee -a $GITHUB_OUTPUT | |
| create-git-tag: | |
| needs: | |
| - set-version | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.1 | |
| - name: Create git tag | |
| run: | | |
| set -x | |
| git config --local user.email "github-actions@comet.com" | |
| git config --local user.name "github-actions" | |
| git tag ${{needs.set-version.outputs.version}} | |
| git push --no-verify origin ${{needs.set-version.outputs.version}} | |
| release-apps: | |
| needs: | |
| - set-version | |
| - create-git-tag | |
| uses: ./.github/workflows/build_apps.yml | |
| secrets: inherit | |
| with: | |
| version: ${{needs.set-version.outputs.version}} | |
| is_release: true | |
| release-sdk: | |
| needs: | |
| - set-version | |
| - create-git-tag | |
| uses: ./.github/workflows/build_and_publish_sdk.yaml | |
| secrets: inherit | |
| with: | |
| version: ${{needs.set-version.outputs.version}} | |
| is_release: true | |
| release-typescript-sdk: | |
| needs: | |
| - set-version | |
| - create-git-tag | |
| uses: ./.github/workflows/typescript_sdk_publish.yml | |
| secrets: inherit | |
| with: | |
| version: ${{needs.set-version.outputs.version}} | |
| is_release: true | |
| skip_commit_push: true | |
| release-typescript-sdk-integrations: | |
| needs: | |
| - set-version | |
| - create-git-tag | |
| uses: ./.github/workflows/typescript_sdk_integration_publish.yml | |
| secrets: inherit | |
| with: | |
| version: ${{needs.set-version.outputs.version}} | |
| is_release: true | |
| skip_commit_push: true | |
| publish-helm-chart: | |
| needs: | |
| - set-version | |
| - create-git-tag | |
| uses: ./.github/workflows/publish_helm_chart.yaml | |
| secrets: inherit | |
| with: | |
| version: ${{needs.set-version.outputs.version}} | |
| create-github-release: | |
| needs: | |
| - set-version | |
| - create-git-tag | |
| - release-apps | |
| - release-sdk | |
| - release-typescript-sdk | |
| - release-typescript-sdk-integrations | |
| - publish-helm-chart | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{needs.set-version.outputs.version}} | |
| generate_release_notes: true | |
| - name: Delete Release Draft | |
| uses: hugo19941994/delete-draft-releases@v1.0.0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| commit-all-version-changes: | |
| needs: | |
| - set-version | |
| - release-typescript-sdk | |
| - release-typescript-sdk-integrations | |
| - publish-helm-chart | |
| - create-github-release | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.1 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| token: ${{ secrets.GH_PAT_TO_ACCESS_GITHUB_API }} | |
| - name: Setup Node.js for TypeScript version update | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Update TypeScript SDK version | |
| shell: bash | |
| working-directory: sdks/typescript | |
| run: | | |
| npm version ${{ needs.set-version.outputs.version }} --no-git-tag-version | |
| - name: Update TypeScript SDK Integrations versions | |
| shell: bash | |
| run: | | |
| for integration in opik-openai opik-gemini opik-langchain opik-vercel; do | |
| if [ -d "sdks/typescript/src/opik/integrations/$integration" ]; then | |
| echo "Updating version for $integration" | |
| cd "sdks/typescript/src/opik/integrations/$integration" | |
| npm version ${{ needs.set-version.outputs.version }} --no-git-tag-version | |
| cd - > /dev/null | |
| fi | |
| done | |
| - name: Update Chart.yaml with release version | |
| shell: bash | |
| run: | | |
| set -x | |
| cd deployment/helm_chart/opik | |
| sed -i "s/^version:.*/version: ${{ needs.set-version.outputs.version }}/" Chart.yaml | |
| sed -i "s/^appVersion:.*/appVersion: ${{ needs.set-version.outputs.version }}/" Chart.yaml | |
| echo "Updated Chart.yaml version and appVersion to: ${{ needs.set-version.outputs.version }}" | |
| cat Chart.yaml | grep -E "^version:|^appVersion:" | |
| cd - | |
| - name: Bump version.txt for next release | |
| id: update_version | |
| shell: bash | |
| run: | | |
| set -x | |
| BASE_VERSION=$(tr -d '\r' < version.txt | xargs) | |
| IFS='.' read -r -a version_parts <<< "$BASE_VERSION" | |
| # Ensure all version parts are set | |
| for i in {0..2}; do | |
| version_parts[$i]=${version_parts[$i]:-0} | |
| done | |
| # Convert to decimal before incrementing to avoid octal interpretation issues | |
| version_parts[2]=$((10#${version_parts[2]} + 1)) | |
| new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}" | |
| # Update version file with the new version | |
| echo "$new_version" > version.txt | |
| echo "new_version=${new_version}" >> $GITHUB_OUTPUT | |
| - name: Commit all version changes | |
| run: | | |
| git config --local user.email "github-actions@comet.com" | |
| git config --local user.name "github-actions" | |
| # Add all modified version files | |
| git add sdks/typescript/package.json sdks/typescript/package-lock.json | |
| git add sdks/typescript/src/opik/integrations/*/package.json sdks/typescript/src/opik/integrations/*/package-lock.json | |
| git add deployment/helm_chart/opik/Chart.yaml | |
| git add version.txt | |
| # Check if there are any changes to commit | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Update versions to ${{ needs.set-version.outputs.version }} and bump base version to ${{ steps.update_version.outputs.new_version }}" | |
| git push origin main | |
| fi | |
| echo "Version updated to ${{ steps.update_version.outputs.new_version }} on main" >> $GITHUB_STEP_SUMMARY |