Example project using GitHub Actions for Allure report with history on GitHub Pages
You can see Allure Report on GitHub Pages
Learn how to use GitHub Actions on official docs
Here is my advices:
- You need to enable actions in '/settings/actions', choosing 'Enable local and third party Actions for this repository'
- Create a workflow '*.yml' file in '.gradle/workflows' directory. Example workflow allure-history.yml
- This workflow uses some GitHub Actions, especially 'allure-report-action'. You can see more about this action on Marketplace
Learn how to use GitHub Pages on official docs
Here is my advices:
- Go to your repository '/settings', scroll down to 'GitHub Pages' section
- By default, 'Source' is set to 'None'
- Set it to 'gh-pages' branch and '/root' folder
- If you don't have 'gh-pages' branch - you can't set it. You need to run workflow even once, and then you have this branch.
- After changing settings you can see URL link in 'GitHub Pages' section like this 'Your site is published at ...'
- Copy this link to repository details (in 'About' section on repo main page) in WebSite field
Here is how this works:
- Step 'Get Allure history' in workflow gets previous 'gh-pages' branch state (there is no error if it doesn't exist yet)
- Step 'Allure Report action':
- Creates temp folder 'allure-history' with a copy of all 'gh-pages' branch files (previous reports)
- Get folder 'last-history' from 'gh-pages' branch to 'allure-results' of current build
- Generate report with Allure Commandline
- Get 'history' folder of current Allure Report to 'last-history' folder for the next build
- Copy current Allure Report to folder with current build number
- Creates 'index.html' file in root of 'allure-history', that will be redirecting to folder with current build number
- Step 'Deploy report to Github Pages' do 'git push' of 'allure-history' folder to 'gh-pages' branch
- And then just magic of GitHub Pages deploy happens, you can open root link of GitHub Pages and always see redirect to the last Allure Report