diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 9accaeb..a85cdad 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -51,6 +51,8 @@ jobs: needs: - build runs-on: ubuntu-latest + outputs: + release-status: ${{ env.release_status }} # Release only where secrets are available. if: >- !github.event.repository.fork @@ -76,6 +78,29 @@ jobs: run: | npm install npx semantic-release + documentation-deploy: + needs: + - release + runs-on: ubuntu-latest + # Update documentation only when there is a new release + if: needs.release.outputs.release-status == released + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + - name: Generate Documentation + run: ./gradlew dokkaHtml + - name: Deploy documentation on GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + keep_files: true + publish_dir: ./build/dokka/html + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' + commit_message: 'docs: update documentation' success: runs-on: ubuntu-22.04 needs: diff --git a/package.json b/package.json index d513657..2f85f6b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "devDependencies": { - "semantic-release-preconfigured-conventional-commits": "1.1.16", - "@qiwi/semrel-metabranch": "3.1.3" + "semantic-release-preconfigured-conventional-commits": "1.1.16" }, "engines": { "node": "18.13" diff --git a/release.config.js b/release.config.js index 5e45607..9185831 100644 --- a/release.config.js +++ b/release.config.js @@ -1,10 +1,14 @@ // Load this configuration that provide all the base for working with conventional commits const config = require('semantic-release-preconfigured-conventional-commits') -// Commands executed during release +/* + Commands executed during release. + It also set an environment variable "release" indicating that the release was successful. +*/ const publishCommands = ` git tag -a -f \${nextRelease.version} \${nextRelease.version} -F CHANGELOG.md || exit 2 git push --force origin \${nextRelease.version} || exit 3 +echo "release_status=released" >> $GITHUB_ENV ` // Only release on branch main const releaseBranches = ["main"] @@ -23,15 +27,6 @@ config.plugins.push( ["@semantic-release/git", { "assets": ["CHANGELOG.md", "package.json"], "message": "chore(release)!: [skip ci] ${nextRelease.version} released" - }], - ["@qiwi/semrel-metabranch", { - "publish" : { - "action" : "push", - "from" : "build/dokka", - "to" : ".", - "branch" : "gh-pages", - "message" : "docs: ${nextRelease.version} documentation released" - } }] )