Github Actions: Workflow 04 - Rebuild content of gh-pages branch (part 2)
Workflow 04-gh-pages-rebuild-part-1.yml is triggered immediately after 02-gh-pages-rebuild-part-1.yml completes.
The purpose of 04-gh-pages-rebuild-part-2.yml is to copy the artifacts built by 02-gh-pages-rebuild-part-1.yml to where they belong on the gh-pages branch so that the site can be deployed.
It uses these Github Action frequently:
dawidd6/action-download-artifact@v6is used to retrieve files from the key/value store to which they were saved in the steps of02-gh-pages-rebuild-part-1.yml.JamesIves/github-pages-deploy-action@v4is used to copy those files into the gh-pages branch.
dawidd6/action-download-artifact@v6
The action dawidd6/action-download-artifact@v6 is used to retrieve the artifacts stored by 02-gh-pages-rebuild-part-1.yml into the working disk storage of the virtual machine running the Github Action.
Here’s an example:
- name: a-javadoc Download artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: 02-gh-pages-rebuild-part-1.yml
github_token: $
name: javadoc
path: $
check_artifacts: true
if_no_artifact_found: error
Here:
nameshould match the name in02-gh-pages-rebuild-part-1.ymlunder which the artifact was storedpathshould match where the contents of the.zipfile in the artifact should be unzipped and stored in the temporary file storage of the virtual machine running the job.
JamesIves/github-pages-deploy-action@v4
The action JamesIves/github-pages-deploy-action@v4 is used to take the unzipped contents from the dawidd6/action-download-artifact@v6 step, and store them somewhere in the gh-pages branch for deployment to the Github Pages site.
Here’s an example:
- name: a-javadoc Deploy Javadoc (Main) 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: $ # The folder where we put the files
clean: true # Automatically remove deleted files from the deploy branch
target-folder: javadoc # The folder that we serve our files from
Here:
folderis the place where the previous step (i.e. thedawidd6/action-download-artifact@v6step) put the files on the local temporary file system where the workflow is running)target-folderis where the files should be placed on thegh-pagesbranch.