Skip to content

Instantly share code, notes, and snippets.

@favoyang
Last active April 20, 2020 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save favoyang/e14f9897843d2fbd48b299ccfa5c171f to your computer and use it in GitHub Desktop.
Save favoyang/e14f9897843d2fbd48b299ccfa5c171f to your computer and use it in GitHub Desktop.
GitHub actions to automate semantic-release with upm branch. https://medium.com/openupm/how-to-maintain-upm-package-part-2-f352fbf5f87c#6bf4
name: CI
on:
push:
branches:
- master
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Semantic release
id: semantic
uses: cycjimmy/semantic-release-action@v2
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
branch: master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create upm branch
run: |
git branch -d upm &> /dev/null || echo upm branch not found
git subtree split -P "$PKG_ROOT" -b upm
git checkout upm
if [[ -d "Samples" ]]; then
git mv Samples Samples~
rm -f Samples.meta
git config --global user.name 'github-bot'
git config --global user.email 'github-bot@users.noreply.github.com'
git commit -am "fix: Samples => Samples~"
fi
git push -f -u origin upm
env:
PKG_ROOT: Packages/com.littlebigfun.semantic-release-upm-example
- name: Create upm git tag
if: steps.semantic.outputs.new_release_published == 'true'
run: |
git tag $TAG upm
git push origin --tags
env:
TAG: upm/v${{ steps.semantic.outputs.new_release_version }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment