Skip to content

Update SDK version

Update SDK version #43

---
name: "Update version in package.json"
on:
workflow_dispatch:
inputs:
version:
description: 'Version to update to (e.g. 1.20.0)'
required: true
jobs:
update:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.UNITY_IMMUTABLE_SDK_GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check team membership
id: check_team
run: |
./.github/scripts/check_team_membership.sh "${{ github.actor }}" "${{ secrets.UNITY_IMMUTABLE_SDK_GITHUB_TOKEN }}"
# shellcheck disable=SC1090
source "$GITHUB_ENV"
echo "${{ github.actor }} is a member of the SDK team: $IS_MEMBER"
if [[ "$IS_MEMBER" != "true" ]]; then
echo "Not a member of the SDK team, skipping update"
exit 1
fi
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install jq
run: sudo apt-get install -y jq
- name: Replace version string
id: replace_version
run: |
FILE=./src/Packages/Passport/package.json
VERSION=${{ github.event.inputs.version }}
jq --arg version "$VERSION" '.version = $version' $FILE > tmp.$$.json && mv tmp.$$.json $FILE
- name: Replace engine sdk version string
id: replace_engine_sdk_version
run: |
FILE=./src/Packages/Passport/Runtime/Scripts/Private/Helpers/SdkVersionInfoHelpers.cs
VERSION=${{ github.event.inputs.version }}
sed -i -E "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/g" $FILE
- uses: gr2m/create-or-update-pull-request-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: "release: update version"
body: "Update version in package.json"
branch: "release/update-version"
commit-message: "release: update version"
labels: release