Merge pull request #119 from jonisavo/chore/2021.3.42f1 #228
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
# Workflow for updating the upm branch automatically. | |
name: upm | |
on: | |
push: | |
branches: [ main ] | |
tags: [ 'v*' ] | |
workflow_dispatch: | |
env: | |
UICOMPONENTS_PATH: 'Assets/UIComponents' | |
BRANCH_NAME: upm | |
jobs: | |
run: | |
name: Update UPM branch | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up github-bot credentials | |
run: | | |
git config --global user.name 'github-bot' | |
git config --global user.email '[email protected]' | |
- name: Copy meta files to package folder | |
run: cp CHANGELOG.md CHANGELOG.md.meta LICENSE.md LICENSE.md.meta README.md README.md.meta "$UICOMPONENTS_PATH" | |
- name: Copy samples to package folder | |
run: | | |
cp -r Assets/Samples/ "$UICOMPONENTS_PATH"/Samples~ | |
rm "$UICOMPONENTS_PATH"/Samples~/*.meta | |
- name: Create commit for the meta files | |
run: | | |
git add -A | |
git commit -m "chore(ci): prepare upm branch" | |
- name: Remove existing upm branch | |
run: git branch -D upm || echo skipping upm branch deletion | |
- name: Split subtree | |
run: git subtree split -P "$UICOMPONENTS_PATH" -b "$BRANCH_NAME" | |
- name: Push subtree | |
run: git push -u origin --force "$BRANCH_NAME" | |
- name: Create UPM tag | |
if: startsWith(github.ref_name, 'v') | |
env: | |
TAG_NAME: ${{ format('upm/{0}', github.ref_name) }} | |
run: | | |
git tag "$TAG_NAME" --annotate --message 'Release $TAG_NAME for upm' "$BRANCH_NAME" | |
git push origin "$TAG_NAME" |