-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use with GitHub Actions? #345
Comments
You'll want to set the user properly and make sure you have the correct credentials. Try using the user flag like this:
Make sure you have the "env" key for the - name: Publish github pages
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/USER_OR_ORG/REPO.git
npx gh-pages -d build -u "github-actions-bot <[email protected]>"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} Props go to @nchaulet for writing a github action that demonstrated this here |
That didn't seem to work for me. I tried without
And without:
Here is my full yaml: - name: 'Deploy'
if: github.event_name != 'pull_request'
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/RehanSaeed/rehansaeed.github.io.git
npx gh-pages --branch master --dist dist --user "github-actions-bot <[email protected]>"
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
You'll have to adjust the syntax for the environment variable substitution for windows I think
|
Here's my repository's github action for reference: https://github.com/UniversalDataTool/universal-data-tool/blob/master/.github/workflows/release-on-master.yml |
Switched to ubuntu and it works. thanks! |
thanks it saved me so much!! hahaha |
complete working example name: "Deployment"
# the event that will trigger the action
on: push
# what the action will do
jobs:
test:
# the operating system it will run on
runs-on: ubuntu-latest
# the list of steps that the action will go through
steps:
- name: "Checkout"
uses: actions/checkout@v2
- name: Get yarn cache directory path # get yarn cache path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2 # cache yarn
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: "Install Dependencies"
run: yarn
- name: "Github Pages Deployment"
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
yarn deploy -u "github-actions-bot <[email protected]>"
if: ${{ github.ref == 'refs/heads/master' }} # only deploy master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} Assumes that the following deploy scripts exist in package.json "scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
|
Hi All, I can't get this to work... it seems to be doubling up on the repo name? Error:
action.yml
|
@hutch120 You need to make the build of react first |
I've been able to set up gh-pages deployments for multiple projects using instructions mentioned here. However with a new project I ran into permissions errors, I think Github has introduced new default settings which need to be changed: #429 (comment). |
I faced the same issue, turns out the production files were in I changed |
ENOENT: no such file or directory, stat '/home/runner/work/soul/soul/build' |
thanks, solved my issue! I was about to use the fine-grained tokens (but they're a bad deal as they expire quickly) |
Updates how `GITHUB_TOKEN` and `GITHUB_REPOSITORY` are referenced to fix the build. tschaub/gh-pages#345 (comment) used for inspiration.
Updates how `GITHUB_TOKEN` and `GITHUB_REPOSITORY` are referenced to fix the build. tschaub/gh-pages#345 (comment) used for inspiration.
I have an npm script like this in
packages.json
:Then in my GitHub Actions
build.yml
I have the following step:Note that adding any arguments after
npm run deploy --
get double quoted, so I moved--repo
into thepackages.json
file.However, this errors with:
The text was updated successfully, but these errors were encountered: