Release and Update SDK Version #71
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: Release and Update SDK Version | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'The new version to release, ex: 0.12.0' | |
| required: true | |
| type: string | |
| sha: | |
| description: '[Optional] Commit SHA1, branch or tag to build. The latest SHA1 on a given branch is used if no value is provided.' | |
| required: false | |
| type: string | |
| emergency: | |
| type: boolean | |
| description: Ignore main branch requirement (SOC2 compliance) | |
| required: true | |
| jobs: | |
| verify-version: | |
| name: Verify arguments | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Print & verify entered "version" | |
| run: | | |
| echo "$version" | |
| if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+(\.[0-9]+)?)?$ ]]; then exit 1; fi | |
| env: | |
| version: ${{ inputs.version }} | |
| release: | |
| needs: "verify-version" | |
| permissions: | |
| id-token: write # required to use OIDC authentication | |
| contents: write | |
| uses: ./.github/workflows/release.yaml | |
| with: | |
| version: ${{ inputs.version }} | |
| sha: ${{ inputs.sha }} | |
| emergency: ${{ inputs.emergency }} | |
| secrets: inherit | |
| update-sdk-version: | |
| name: Update SDK version | |
| needs: "verify-version" | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout repo to Github Actions runner | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 'Update the content of platform/shared/.sdk_version' | |
| run: | | |
| echo -n '${{ inputs.version }}' > $file | |
| echo "Updated content of '$file' file:" | |
| cat $file | |
| env: | |
| file: 'platform/shared/.sdk_version' | |
| - name: 'Create Github Token' | |
| id: org-pr-create-token | |
| uses: getsentry/action-github-app-token@d4b5da6c5e37703f8c3b3e43abb5705b46e159cc # v3.0.0 | |
| with: | |
| app_id: ${{ secrets.OPEN_CAPTURE_SDK_PRS_APP_ID }} | |
| private_key: ${{ secrets.OPEN_CAPTURE_SDK_PRS_PRIVATE_KEY }} | |
| - name: 'Commiting the changes' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git checkout -b "update-sdk-version-${{ inputs.version }}" | |
| git \ | |
| -c author.name="${{ github.actor }}" \ | |
| -c author.email="${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" \ | |
| -c user.name="GitHub Action" \ | |
| -c user.email="noreply@github.com" \ | |
| commit \ | |
| -am 'Update SDK version to ${{ inputs.version }}' | |
| git push origin "update-sdk-version-${{ inputs.version }}" | |
| - name: 'Create Pull Request' | |
| env: | |
| GITHUB_TOKEN: ${{ steps.org-pr-create-token.outputs.token }} | |
| run: | | |
| # Create PR and capture the URL | |
| PR_URL=$(gh pr create --fill --head update-sdk-version-${{ inputs.version }}) | |
| echo "PR created at $PR_URL" | |
| # Request review from the current user | |
| gh pr review-request --add "${{ github.actor }}" --repo "$GITHUB_REPOSITORY" --pr "$PR_URL" | |
| # Enable auto-merge | |
| gh pr merge "$PR_URL" --auto --merge |