-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: deploy to gh-pages with GitHub Actions (#228)
We don't need to keep a history of the built site, so we can get rid of the gh-pages branch. In addition, we are sure to now have a fresh deploy. With the branch, some extra files are kept except if they are removed manually. Removing the branch will also reduce the size of the repository.
- Loading branch information
Showing
1 changed file
with
21 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,13 @@ on: | |
- '.github/actions/build-setup/**/*' | ||
- '.github/workflows/publish-online-example.yml' | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
generate_theme_example: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -27,27 +32,23 @@ jobs: | |
env: | ||
BONITA_THEME_URL: 'https://bonitasoft.github.io/bonita-documentation-theme/' | ||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
name: theme-example-${{github.sha}} | ||
path: public | ||
|
||
push_examples_to_gh_pages: | ||
if: github.event.ref == 'refs/heads/master' | ||
runs-on: ubuntu-22.04 | ||
needs: generate_theme_example | ||
deploy: | ||
needs: build | ||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | ||
permissions: | ||
contents: write # Push to gh-pages | ||
contents: read | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
actions: read # to download an artifact uploaded by `actions/upload-pages-artifact@v3` | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Download | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: theme-example-${{github.sha}} | ||
- name: Push to gh-pages | ||
uses: peaceiris/actions-gh-pages@v4 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./ | ||
keep_files: true | ||
user_name: 'bonita-theme-bot' | ||
user_email: '[email protected]' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |