DEV Community

Cover image for Deploy your projects to Github Pages with GitHub Actions

Deploy your projects to Github Pages with GitHub Actions

pierresaid on August 31, 2019

In this post I am going to explain how to set up a basic workflow that uses an existing GitHub action. This workflow will deploy a static web site ...
Collapse
 
swinton profile image
Steve Winton

Nice write up!

I think ${{ secrets.ACCESS_TOKEN }} in your example can be replaced with ${{ secrets.GITHUB_TOKEN }}, which is a repo-scoped token automatically generated for you by GitHub. Did you try this?

Collapse
 
pierresaid profile image
pierresaid • Edited

Thanks!

I just tried it, but it didn't work.
Also, I couldn't find the documentation about this auto generated token.

Collapse
 
swinton profile image
Steve Winton

Hmmm. It’s documented here:

help.github.com/en/articles/virtua...

But maybe it doesn’t carry the right permissions for your use case. Did you get a permissions error?

Thread Thread
 
pierresaid profile image
pierresaid

When the Action try to push the changes, it pops this error in the logs:

fatal: could not read Password for 'https://***@github.com': No such device or address

That must be a permissions error. The personal access token that I generated before (ACCESS_TOKEN) had full control of my private repositories.

Collapse
 
renato66 profile image
Renato Vicente

could you upgrade this article to v3

Collapse
 
pierresaid profile image
pierresaid

Done !

Collapse
 
pierresaid profile image
pierresaid

Fixed it ! 👍

Collapse
 
snmi___ profile image
Sanmi

How do we implement the process.env with plain html/css/vanilla js?

Collapse
 
noamtamim profile image
Noam Tamim

Please explain -- why should I use it? GitHub Pages are already automatically deployed. What am I missing?

Collapse
 
pierresaid profile image
pierresaid • Edited

For project like React, Vue or Angular you will need to build the project to have the html,css and js files that Github Pages can serve.

Github Actions will automate this step for you.

Collapse
 
noamtamim profile image
Noam Tamim

You mean, for sites that are not simple Jekyll? Got it.

Collapse
 
pierresaid profile image
pierresaid

Thanks 😀