Skip to content

Commit 76fcef6

Browse files
ci: modify condition for documentation deploy
1 parent 9002f26 commit 76fcef6

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ jobs:
5151
needs:
5252
- build
5353
runs-on: ubuntu-latest
54+
outputs:
55+
release-status: ${{ env.release_status }}
5456
# Release only where secrets are available.
5557
if: >-
5658
!github.event.repository.fork
@@ -76,6 +78,29 @@ jobs:
7678
run: |
7779
npm install
7880
npx semantic-release
81+
documentation-deploy:
82+
needs:
83+
- release
84+
runs-on: ubuntu-latest
85+
# Update documentation only when there is a new release
86+
if: needs.release.outputs.release-status == released
87+
steps:
88+
- name: Checkout the repository
89+
uses: actions/checkout@v3
90+
with:
91+
submodules: recursive
92+
fetch-depth: 0
93+
- name: Generate Documentation
94+
run: ./gradlew dokkaHtml
95+
- name: Deploy documentation on GitHub Pages
96+
uses: peaceiris/actions-gh-pages@v3
97+
with:
98+
github_token: ${{ secrets.GITHUB_TOKEN }}
99+
keep_files: true
100+
publish_dir: ./build/dokka/html
101+
user_name: 'github-actions[bot]'
102+
user_email: 'github-actions[bot]@users.noreply.github.com'
103+
commit_message: 'docs: update documentation'
79104
success:
80105
runs-on: ubuntu-22.04
81106
needs:

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"devDependencies": {
3-
"semantic-release-preconfigured-conventional-commits": "1.1.16",
4-
"@qiwi/semrel-metabranch": "3.1.3"
3+
"semantic-release-preconfigured-conventional-commits": "1.1.16"
54
},
65
"engines": {
76
"node": "18.13"

release.config.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
// Load this configuration that provide all the base for working with conventional commits
22
const config = require('semantic-release-preconfigured-conventional-commits')
33

4-
// Commands executed during release
4+
/*
5+
Commands executed during release.
6+
It also set an environment variable "release" indicating that the release was successful.
7+
*/
58
const publishCommands = `
69
git tag -a -f \${nextRelease.version} \${nextRelease.version} -F CHANGELOG.md || exit 2
710
git push --force origin \${nextRelease.version} || exit 3
11+
echo "release_status=released" >> $GITHUB_ENV
812
`
913
// Only release on branch main
1014
const releaseBranches = ["main"]
@@ -23,15 +27,6 @@ config.plugins.push(
2327
["@semantic-release/git", {
2428
"assets": ["CHANGELOG.md", "package.json"],
2529
"message": "chore(release)!: [skip ci] ${nextRelease.version} released"
26-
}],
27-
["@qiwi/semrel-metabranch", {
28-
"publish" : {
29-
"action" : "push",
30-
"from" : "build/dokka",
31-
"to" : ".",
32-
"branch" : "gh-pages",
33-
"message" : "docs: ${nextRelease.version} documentation released"
34-
}
3530
}]
3631
)
3732

0 commit comments

Comments
 (0)