Skip to content

Commit 0d7be6c

Browse files
committed
cleanup: use the composed environment setup
1 parent b0dcb4f commit 0d7be6c

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'Setup Environment'
2+
description: 'Common setup steps for Unity release workflows'
3+
4+
inputs:
5+
release_branch:
6+
description: 'The release branch to checkout'
7+
required: true
8+
9+
runs:
10+
using: 'composite'
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v5
14+
with:
15+
ref: ${{ inputs.release_branch }}
16+
shell: bash
17+
18+
- name: Configure Git
19+
shell: bash
20+
run: |
21+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
22+
git config --global user.name "github-actions[bot]"
23+
24+
- name: Prepare Environment
25+
env:
26+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
shell: bash
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y gh jq || true
31+
gh auth status || gh auth login --with-token <<< "$GH_TOKEN"
32+

.github/workflows/create-release-pr.yml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,10 @@ jobs:
5353
android_from: ${{ steps.current_versions.outputs.android_from }}
5454

5555
steps:
56-
- name: Checkout
57-
uses: actions/checkout@v5
56+
- name: Setup Environment
57+
uses: ./.github/actions/setup-environment
5858
with:
59-
ref: ${{ needs.prep.outputs.release_branch }}
60-
61-
- name: Configure Git
62-
run: |
63-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
64-
git config --global user.name "github-actions[bot]"
65-
66-
- name: Prepare Environment
67-
env:
68-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69-
run: |
70-
sudo apt-get update
71-
sudo apt-get install -y gh jq || true
72-
gh auth status || gh auth login --with-token <<< "$GH_TOKEN"
59+
release_branch: ${{ needs.prep.outputs.release_branch }}
7360

7461
- name: Get current native SDK versions
7562
id: current_versions
@@ -151,10 +138,10 @@ jobs:
151138
needs: [prep, update-version]
152139
runs-on: ubuntu-latest
153140
steps:
154-
- name: Checkout
155-
uses: actions/checkout@v5
141+
- name: Setup Environment
142+
uses: ./.github/actions/setup-environment
156143
with:
157-
ref: ${{ needs.prep.outputs.release_branch }}
144+
release_branch: ${{ needs.prep.outputs.release_branch }}
158145

159146
- name: Update Unity SDK version
160147
run: |
@@ -201,7 +188,7 @@ jobs:
201188
- name: Cache Unity
202189
uses: actions/cache@v4
203190
with:
204-
path: /home/runner/Unity/Hub/Editor
191+
path: /home/runner/Unity/Hub
205192
key: UnityEditor-${{ runner.os }}
206193
restore-keys: |
207194
UnityEditor-${{ runner.os }}

0 commit comments

Comments
 (0)