Update SDK Version #16
This file contains 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: Update SDK Version | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The new version to release, ex: 0.12.0' | |
required: true | |
type: string | |
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 }} | |
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="[email protected]" \ | |
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: | | |
gh pr create --fill |