Skip to content

Commit

Permalink
fix(ci): update semantic-release settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Iam1337 committed Jan 7, 2022
1 parent 54726be commit bf56846
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 73 deletions.
84 changes: 29 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,84 +3,58 @@ on:
push:
branches:
- master

jobs:
release:
name: ⚙ Release
runs-on: ubuntu-latest
env:
PROJECT_NAME: extTerrain2D
PROJECT_ASSETS: README.md:CHANGELOG.md:LICENSE
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build unitypackage
run: |
echo Assets/extTerrain2D.meta >> metaList
find Assets/extTerrain2D -name \*.meta >> metaList
- uses: pCYSl5EDgo/create-unitypackage@master
with:
package-path: extTerrain2D.unitypackage
include-files: metaList
project-folder: ./
- name: Semantic release
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: master
extra_plugins: |
@semantic-release/changelog
@semantic-release/changelog
@semantic-release/git
branch: master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update upm branch
@iam1337/create-unitypackage
- name: Push UPM update
run: |
echo '>>> Start'
git log -1
IFS=: read -r -a PROJECT_ASSETS_ARRAY <<< "$PROJECT_ASSETS"
mkdir Temp
cp README.md Temp/README.md
cp CHANGELOG.md Temp/CHANGELOG.md
cp LICENSE Temp/LICENSE
echo '>>> Delete local upm branch'
git branch -d upm &> /dev/null || echo upm branch not found
echo
echo '>>> Split upm branch'
git subtree split -P "$PKG_ROOT" -b upm
for asset in "${PROJECT_ASSETS_ARRAY[@]}"; do
cp ${asset} Temp/${asset}
done
echo
echo '>>> Checkout upm branch'
git log -1
git subtree split -P "Assets/$PROJECT_NAME" -b upm
git checkout upm
cp Temp/README.md README.md
git add README.md
cp Temp/CHANGELOG.md CHANGELOG.md
git add CHANGELOG.md
cp Temp/LICENSE LICENSE
git add LICENSE
for asset in "${PROJECT_ASSETS_ARRAY[@]}"; do
cp Temp/${asset} ${asset}
git add ${asset}
done
if [[ -d "Examples" ]]; then
echo
echo '>>> Examples move to Examples~'
git mv Examples Examples~
rm -f Examples.meta
fi
git config --global user.name 'github-bot'
git config --global user.email 'github-bot@users.noreply.github.com'
git commit -am "$MSG"
echo
echo '>>> Force overwrite remote upm branch'
git config user.name github-actions
git config user.email github-actions@github.com
git commit -am "chore(release): update upm branch [skip ci]"
git push -f -u origin upm
env:
PKG_ROOT: Assets/extTerrain2D
MSG: "chore(release): finalize UPM package"
- name: Create upm git tag
- name: Push UPM tag
if: steps.semantic.outputs.new_release_published == 'true'
env:
UPM_TAG: upm/v${{ steps.semantic.outputs.new_release_version }}
run: |
git tag $TAG upm
git push origin --tags
env:
TAG: upm/v${{ steps.semantic.outputs.new_release_version }}
git tag $UPM_TAG upm
git push origin --tags
18 changes: 0 additions & 18 deletions .releaserc.json

This file was deleted.

39 changes: 39 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
"branches" : "main",
"tagFormat": "v${version}",
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "angular",
"releaseRules" : [
{"type": "docs", "release": "patch"},
{"type": "docs", "scope": "README", "release": false}
]
}],
["@semantic-release/release-notes-generator", {
"writerOpts": {
"commitsSort": ["scope", "subject"]
}
}],
["@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}],
["@semantic-release/npm", {
"npmPublish": false,
"pkgRoot": `Assets/${process.env.PROJECT_NAME}` }],
["@semantic-release/git", {
"assets": [`Assets/${process.env.PROJECT_NAME}/package.json`, "CHANGELOG.md"],
"message": "chore(release): new release ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}],
["@iam1337/create-unitypackage", {
"packageRoot": `Assets/${process.env.PROJECT_NAME}`,
"projectRoot": "./",
"output": `${process.env.PROJECT_NAME}.unitypackage`
}],
["@semantic-release/github", {
"assets": [
{"path": `${process.env.PROJECT_NAME}.unitypackage`, "label": `${process.env.PROJECT_NAME} v\${nextRelease.version}`}
]
}]
],
"preset": "angular"
}

0 comments on commit bf56846

Please sign in to comment.