From 7a99d43ec44d91b2f067b3a5f2e443db4518c437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20L?= Date: Fri, 2 Jun 2023 17:19:34 +0200 Subject: [PATCH] Testing semantic release CI --- .github/workflows/ci.yml | 84 +++++++++++++++++++++++++++++++--------- .releaserc.json | 14 +++++++ 2 files changed, 80 insertions(+), 18 deletions(-) create mode 100644 .releaserc.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3480f0f..0c35de6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,27 +1,75 @@ name: CI - on: push: branches: - - master - + - master jobs: - split-upm: - name: update upm branch + release: + name: release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: update upm branch - run: | - echo '### head info' - git log -1 + - 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: Assets/Klem-Unity-Tool-Belt + - 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 }} + - echo '### split upm branch' - git subtree split -P "$PKG_ROOT" -b upm - echo '### update remote upm branch' - git push origin upm - env: - PKG_ROOT: Assets/Klem-Unity-Tool-Belt +#name: CI +# +#on: +# push: +# branches: +# - master +# +#jobs: +# split-upm: +# name: update upm branch +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 +# - name: update upm branch +# run: | +# echo '### head info' +# git log -1 +# +# echo '### split upm branch' +# git subtree split -P "$PKG_ROOT" -b upm +# +# echo '### update remote upm branch' +# git push origin upm +# env: +# PKG_ROOT: Assets/Klem-Unity-Tool-Belt diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..22a450d --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,14 @@ +{ + "tagFormat": "v${version}", + "plugins": [ + ["@semantic-release/commit-analyzer", { "preset": "angular" }], + "@semantic-release/release-notes-generator", + ["@semantic-release/changelog", { "preset": "angular" }], + ["@semantic-release/npm", { "npmPublish": false }], + ["@semantic-release/git", { + "assets": ["package.json", "CHANGELOG.md"], + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + }], + "@semantic-release/github" + ] +} \ No newline at end of file