Skip to content

Merge pull request #102 from kirurobo/dev_patch #1

Merge pull request #102 from kirurobo/dev_patch

Merge pull request #102 from kirurobo/dev_patch #1

Workflow file for this run

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"