-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DX-3037] ci: update release.yml (#103)
* ci: update release.yml * ci: update update-version.xml, add tag workflow which creates a release
- Loading branch information
Showing
4 changed files
with
131 additions
and
36 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
|
||
USER=$1 | ||
|
||
response=$(gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
"/orgs/immutable/teams/sdk/memberships/${USER}") | ||
|
||
echo "$response" | ||
|
||
if echo "$response" | grep -q '"state":"active"'; then | ||
IS_MEMBER=true | ||
else | ||
IS_MEMBER=false | ||
fi | ||
echo "$IS_MEMBER" | ||
|
||
# Set the environment variable for the GitHub workflow | ||
echo "IS_MEMBER=$IS_MEMBER" >> "$GITHUB_ENV" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
--- | ||
name: 'Create Release' | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_run: | ||
workflows: ["Tag Release"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
release: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Extract TS SDK version from index.html | ||
id: extract_ts_sdk_version | ||
run: | | ||
version=$(grep -oP '"x-sdk-version":"ts-immutable-sdk-\K[0-9]+\.[0-9]+\.[0-9]+' ./Web/index.js | head -n 1) | ||
if [[ -z "$version" ]]; then | ||
echo "Error: Version not found in index.js" >&2 | ||
exit 1 | ||
fi | ||
version=$(echo "$version" | tr -d '\r\n') | ||
echo "VERSION=${version}" >> "$GITHUB_ENV" | ||
- name: Build Changelog | ||
id: github_release | ||
uses: mikepenz/release-changelog-builder-action@v3 | ||
|
@@ -33,6 +52,9 @@ jobs: | |
- name: Create Release | ||
uses: mikepenz/[email protected] | ||
with: | ||
body: ${{steps.github_release.outputs.changelog}} | ||
body: | | ||
${{steps.github_release.outputs.changelog}} | ||
Game bridge built from Immutable Typescript SDK version ${{ env.VERSION }} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: "Tag Release" | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
create-tag: | ||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Extract version from ImmutableDataTypes.h | ||
id: extract_version | ||
run: | | ||
version=$(grep -oP '#define ENGINE_SDK_VERSION TEXT\("\K[0-9]+\.[0-9]+\.[0-9]+' ImmutableDataTypes.h) | ||
if [[ -z "$version" ]]; then | ||
echo "Error: Version not found in ImmutableDataTypes.h" >&2 | ||
exit 1 | ||
fi | ||
version=$(echo "$version" | tr -d '\r\n') | ||
echo "VERSION=${version}" >> "$GITHUB_ENV" | ||
- name: Create Tag | ||
uses: negz/create-tag@v1 | ||
with: | ||
version: "v${{ env.VERSION }}" | ||
message: "Version ${{ env.VERSION }}" | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,47 @@ | ||
--- | ||
name: "Update engine SDK version in Immutable Data Types" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to update to (e.g. 1.20.0)' | ||
required: true | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
name: "Update engine SDK version in ImmutableDataTypes.h" | ||
|
||
# - name: Check team membership | ||
# id: check_team | ||
# run: | | ||
# IS_MEMBER=$(./.github/scripts/check_team_membership.sh "${{ github.actor }}" "${{ secrets.GITHUB_TOKEN }}") | ||
# if [[ "$IS_MEMBER" != "true" ]]; then | ||
# echo "Not a member of the SDK team, skipping update" | ||
# exit 1 | ||
# fi | ||
|
||
- name: Replace engine sdk version string | ||
id: replace_engine_sdk_version | ||
run: | | ||
FILE=./Source/Immutable/Public/Immutable/ImmutableDataTypes.h | ||
VERSION=${{ github.event.inputs.version }} | ||
sed -i -E "s/#define ENGINE_SDK_VERSION TEXT\(\"[0-9]+\.[0-9]+\.[0-9]+\"\)/#define ENGINE_SDK_VERSION TEXT(\"$VERSION\")/g" $FILE | ||
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.UNREAL_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.UNREAL_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: Replace engine sdk version string | ||
id: replace_engine_sdk_version | ||
run: | | ||
FILE=./Source/Immutable/Public/Immutable/ImmutableDataTypes.h | ||
VERSION=${{ github.event.inputs.version }} | ||
sed -i -E "s/#define ENGINE_SDK_VERSION TEXT\(\"[0-9]+\.[0-9]+\.[0-9]+\"\)/#define ENGINE_SDK_VERSION TEXT(\"$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 ImmutableDataTypes.h" | ||
branch: "release/update-version" | ||
commit-message: "release: update version" | ||
labels: release |