Skip to content

Commit

Permalink
ci: modify condition for documentation deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGiulianelli committed Jan 16, 2023
1 parent 9002f26 commit 76fcef6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
15 changes: 5 additions & 10 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -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"
}
}]
)

Expand Down

0 comments on commit 76fcef6

Please # to comment.