Skip to content

Merge pull request #6 from OpenCommissioning/development #4

Merge pull request #6 from OpenCommissioning/development

Merge pull request #6 from OpenCommissioning/development #4

Workflow file for this run

name: Release
on:
push:
branches: [master]
workflow_dispatch:
jobs:
build-package:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Semantic release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# Recreate the UPM (Release) branch for the latest version
- name: Create UPM Branch
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Checking out UPM Branch
git checkout master
git config --global user.name oc-bot
git config --global user.email opencommissioning@spiratec.com
git checkout -B upm
# Prep for release, hide Samples/ from Unity's compiler
- name: Refactor/Hide Samples Folder
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Refactoring Samples
if [[ -d "Samples" ]]; then
git mv Samples Samples~
rm -f Samples.meta
fi
# Prep for release, hide Documentation/ from Unity's compiler
- name: Refactor/Hide Documentation Folder
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Refactoring Documentation
if [[ -d "Documentation" ]]; then
git mv Documentation Documentation~
rm -f Documentation.meta
fi
# Prep for release, hide Tests/ from Unity's compiler
- name: Refactor/Hide Tests Folder
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Refactoring Documentation
if [[ -d "Tests" ]]; then
git mv Tests Tests~
rm -f Tests.meta
fi
# RIf there's a new version, remove unwanted files from the upm branch
- name: Remove CI Files
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Removing Continuous Integration Files
rm -f ".releaserc.json"
rm -rf ".github"
rm -f ".gitignore"
# Push the UPM branch with this release
- name: Push UPM Branch
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Pushing Release to UPM Branch
git commit -am "Release v${{steps.semantic.outputs.new_release_version}}"
git push -f -u origin upm
# Tag the UPM branch with this release
- name: Tag UPM Branch
if: steps.semantic.outputs.new_release_published == 'true'
run: |
git tag -f upm/v${{ steps.semantic.outputs.new_release_version }} upm
git push -f origin --tags
# Create package tarball for release artifact
- name: Create Package Tarball
if: steps.semantic.outputs.new_release_published == 'true'
run: |
mkdir package && find . -maxdepth 1 ! -name "package" ! -name "." -exec mv {} package/ \; && tar -czf OC-Core-${{steps.semantic.outputs.new_release_version}}.tar.gz package/ && shopt -s dotglob && mv package/* ./ && rmdir package
# Publish this tagged as a release
- name: Publish New Repo Release
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Creating Repo Release
gh release create upm/v${{steps.semantic.outputs.new_release_version}} -t "Release ${{steps.semantic.outputs.new_release_version}}" -n "${{steps.semantic.outputs.new_release_notes}}"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# Upload package Tarball
- name: Upload Release Artifact
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo Uploading release asset
gh release upload upm/v${{ steps.semantic.outputs.new_release_version }} OC-Core-${{ steps.semantic.outputs.new_release_version }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}