Merge pull request #69 from kirurobo/dev_mac #3
Workflow file for this run
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
name: Generate upm branches | |
# Reference | |
# - https://tips.hecomi.com/entry/2021/10/29/001304 | |
on: | |
push: | |
tags: | |
- v* | |
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 }} |