I created a GitHub page following the instructions and it is published under GitHub Pages as example.github.io
.
Now I would like to add to this page the HTML pages of my projects, which are stored in other repositories different from the one where the page is stored. For example, I would like to add my_project.html
which is stored in my_repo
.
To this aim, I would prefer
example.github.io
repository (because if I update the project, it will not be updated on example.github.io
)Is there a way to, for example, clone the single html file my_project.html
from the my_repo
repository to the example.github.io
one?
Or to directly link to the HTML page?
Please, notice also that I am relatively new to GitHub and I use it through the browser interface.
I already made all the naive attempts like adding a link to https://example.github.io/my_user/my_repo/blob/main/my_project.html
, to https://example.github.io/my_user/my_repo/my_project.html
, etc., but I am well aware they will not work if the html file I want is not contained in the same repository as the index.html.
You can use GitHub Actions to deploy your project to GitHub Pages, and download the files with a script before deploying the project :
workflow.yml :
jobs:
deploy:
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download files
run: |
wget https://github.com/paolosaracco/MTG-TopRankedDecks/blob/81498093c5b6d3cfd1c6767f34d98902a9f2488b/MtG_project.html
wget https://github.com/paolosaracco/MTG-TopRankedDecks/blob/*************/MtG_project.html
# etc
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: / # Where all the static files are located
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
You can find more documentation here to deploy with a workflow : https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow