forked from kirurobo/UniWindowController
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (46 loc) · 1.68 KB
/
main.yml
File metadata and controls
58 lines (46 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Generate preview-upm branches
# Reference
# - https://tips.hecomi.com/entry/2021/10/29/001304
on:
push:
branches:
- main
workflow_dispatch:
env:
MAIN_BRANCH: main
UPM_BRANCH: preview-upm
PKG_ROOT_DIR: UniWinC/Assets/Kirurobo/UniWindowController
SAMPLES_DIR: Samples
DOC_FILES:
jobs:
update:
runs-on: ubuntu-latest
steps:
# 最新のリリースバージョンを取得
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- run: git checkout "$MAIN_BRANCH"
# 生成者の名前を設定
- name: Git config
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# UPM 用のブランチを作成
- name: Create preview UPM branches
run: |
# 古いブランチを削除
git branch -D "$UPM_BRANCH" &> /dev/null || echo "$UPM_BRANCH" branch is not found
# アセットの中身を UPM ブランチに切り出す
git subtree split -P "$PKG_ROOT_DIR" -b "$UPM_BRANCH"
# 切り出したブランチに移動
git checkout "$UPM_BRANCH"
# サンプルディレクトリを ~ 付きに改名
git mv "$SAMPLES_DIR" "$SAMPLES_DIR~" &> /dev/null || echo "$SAMPLES_DIR" is not found
# サンプルディレクトリの .meta は削除
rm "$SAMPLES_DIR.meta"
# タグ名とともにコミット
git commit -am "Update preview UPM."
# GitHubへプッシュ
git push -f origin "$UPM_BRANCH"