forked from kirurobo/UniWindowController
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (62 loc) · 2.58 KB
/
upm.yml
File metadata and controls
78 lines (62 loc) · 2.58 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Generate upm branches
# Reference
# - https://tips.hecomi.com/entry/2021/10/29/001304
on:
push:
# main ブランチが更新されたときではなく、'v*' というタグが push されたときにのみ実行させる
tags:
- v*
workflow_dispatch:
env:
MAIN_BRANCH: main
UPM_BRANCH: 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"
# イベントを起動したタグを steps.tag.outputs.name に格納
- name: Tag name
id: tag
run: echo ::set-output name=name::${GITHUB_REF#refs/tags/v}
# 生成者の名前を設定
- 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 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"
## メインブランチにあった README などをインポート
#for file in "$DOC_FILES"; do
# git checkout "$MAIN_BRANCH" $file &> /dev/null || echo "$file" is not found
#done
# サンプルディレクトリを ~ 付きに改名
git mv "$SAMPLES_DIR" "$SAMPLES_DIR~" &> /dev/null || echo "$SAMPLES_DIR" is not found
# サンプルディレクトリの .meta は削除
rm "$SAMPLES_DIR.meta"
## package.json のバージョンを置換
# sed -i -e "s/\"version\":.*$\"version\": \"$TAG\",/" package.json || echo package.json is not found
# タグ名とともにコミット
git commit -am "release $TAG."
# GitHubへプッシュ
git push -f origin "$UPM_BRANCH"
# タグ付きのブランチも作成してプッシュ
git checkout -b "$UPM_BRANCH@$TAG"
git push -f origin "$UPM_BRANCH@$TAG"
env:
TAG: ${{ steps.tag.outputs.name }}