Skip to content

Commit ee0f077

Browse files
committed
ci: update update-version.xml, add tag workflow which creates a release
1 parent 4dea2d0 commit ee0f077

File tree

4 files changed

+109
-34
lines changed

4 files changed

+109
-34
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -x
4+
5+
USER=$1
6+
7+
response=$(gh api \
8+
-H "Accept: application/vnd.github+json" \
9+
-H "X-GitHub-Api-Version: 2022-11-28" \
10+
"/orgs/immutable/teams/sdk/memberships/${USER}")
11+
12+
echo "$response"
13+
14+
if echo "$response" | grep -q '"state":"active"'; then
15+
IS_MEMBER=true
16+
else
17+
IS_MEMBER=false
18+
fi
19+
echo "$IS_MEMBER"
20+
21+
# Set the environment variable for the GitHub workflow
22+
echo "IS_MEMBER=$IS_MEMBER" >> "$GITHUB_ENV"

.github/workflows/release.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
22
name: 'Create Release'
3+
34
on:
4-
push:
5-
tags:
6-
- '*'
5+
workflow_run:
6+
workflows: ["Tag Release"]
7+
types:
8+
- completed
79

810
jobs:
911
release:
10-
if: startsWith(github.ref, 'refs/tags/')
12+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1113
runs-on: ubuntu-latest
1214
steps:
1315
- name: Checkout code

.github/workflows/tag.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: "Tag Release"
3+
4+
on:
5+
pull_request:
6+
types: [closed]
7+
8+
jobs:
9+
create-tag:
10+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Extract version from ImmutableDataTypes.h
18+
id: extract_version
19+
run: |
20+
version=$(grep -oP '#define ENGINE_SDK_VERSION TEXT\("\K[0-9]+\.[0-9]+\.[0-9]+' ImmutableDataTypes.h)
21+
22+
if [[ -z "$version" ]]; then
23+
echo "Error: Version not found in ImmutableDataTypes.h" >&2
24+
exit 1
25+
fi
26+
27+
version=$(echo "$version" | tr -d '\r\n')
28+
29+
echo "VERSION=${version}" >> "$GITHUB_ENV"
30+
31+
- name: Create Tag
32+
uses: negz/create-tag@v1
33+
with:
34+
version: "v${{ env.VERSION }}"
35+
message: "Version ${{ env.VERSION }}"
36+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/update-version.yml

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,47 @@
11
---
2-
name: "Update engine SDK version in Immutable Data Types"
3-
4-
on:
5-
workflow_dispatch:
6-
inputs:
7-
version:
8-
description: 'Version to update to (e.g. 1.20.0)'
9-
required: true
10-
11-
jobs:
12-
update:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v3
2+
name: "Update engine SDK version in ImmutableDataTypes.h"
173

18-
# - name: Check team membership
19-
# id: check_team
20-
# run: |
21-
# IS_MEMBER=$(./.github/scripts/check_team_membership.sh "${{ github.actor }}" "${{ secrets.GITHUB_TOKEN }}")
22-
# if [[ "$IS_MEMBER" != "true" ]]; then
23-
# echo "Not a member of the SDK team, skipping update"
24-
# exit 1
25-
# fi
26-
27-
- name: Replace engine sdk version string
28-
id: replace_engine_sdk_version
29-
run: |
30-
FILE=./Source/Immutable/Public/Immutable/ImmutableDataTypes.h
31-
VERSION=${{ github.event.inputs.version }}
32-
sed -i -E "s/#define ENGINE_SDK_VERSION TEXT\(\"[0-9]+\.[0-9]+\.[0-9]+\"\)/#define ENGINE_SDK_VERSION TEXT(\"$VERSION\")/g" $FILE
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Version to update to (e.g. 1.20.0)'
9+
required: true
10+
11+
jobs:
12+
update:
13+
runs-on: ubuntu-latest
14+
env:
15+
GH_TOKEN: ${{ secrets.UNITY_IMMUTABLE_SDK_GITHUB_TOKEN }}
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: Check team membership
21+
id: check_team
22+
run: |
23+
./.github/scripts/check_team_membership.sh "${{ github.actor }}" "${{ secrets.UNREAL_IMMUTABLE_SDK_GITHUB_TOKEN }}"
24+
# shellcheck disable=SC1090
25+
source "$GITHUB_ENV"
26+
echo "${{ github.actor }} is a member of the SDK team: $IS_MEMBER"
27+
if [[ "$IS_MEMBER" != "true" ]]; then
28+
echo "Not a member of the SDK team, skipping update"
29+
exit 1
30+
fi
31+
32+
- name: Replace engine sdk version string
33+
id: replace_engine_sdk_version
34+
run: |
35+
FILE=./Source/Immutable/Public/Immutable/ImmutableDataTypes.h
36+
VERSION=${{ github.event.inputs.version }}
37+
sed -i -E "s/#define ENGINE_SDK_VERSION TEXT\(\"[0-9]+\.[0-9]+\.[0-9]+\"\)/#define ENGINE_SDK_VERSION TEXT(\"$VERSION\")/g" $FILE
38+
39+
- uses: gr2m/create-or-update-pull-request-action@v1
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
title: "release: update version"
44+
body: "Update version in ImmutableDataTypes.h"
45+
branch: "release/update-version"
46+
commit-message: "release: update version"
47+
labels: release

0 commit comments

Comments
 (0)