GithubHelp home page GithubHelp logo

crazy-max / ghaction-github-pages Goto Github PK

View Code? Open in Web Editor NEW
451.0 8.0 39.0 16.18 MB

GitHub Action to deploy to GitHub Pages

Home Page: https://github.com/marketplace/actions/github-pages

License: MIT License

TypeScript 76.58% HCL 6.93% Dockerfile 16.50%
github-actions github-pages deployment actions

ghaction-github-pages's Introduction

GitHub release GitHub marketplace CI workflow Become a sponsor Paypal Donate

About

A GitHub Action to deploy to GitHub Pages

GitHub Pages


Usage

Workflow

Below is a simple snippet to deploy to GitHub Pages with a dummy HTML page.

A workflow is also available for this repository and deploys every day to GitHub Pages.

name: website

on: push

permissions: 
  contents: write

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v4
      -
        name: Gen dummy page
        run: |
          mkdir public
          cat > public/index.html <<EOL
          <!doctype html>
          <html>
            <head>
              <title>GitHub Pages deployed!</title>
            </head>
            <body>
              <p>GitHub Pages with <strong>${{ github.sha }}</strong> commit ID has been deployed through <a href="https://github.com/marketplace/actions/github-pages">GitHub Pages action</a> successfully.</p>
            </body>
          </html>
          EOL
      -
        name: Deploy to GitHub Pages
        uses: crazy-max/ghaction-github-pages@v4
        with:
          target_branch: gh-pages
          build_dir: public
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Sign commits

You can use the Import GPG action along with this one to sign commits:

      -
        name: Import GPG key
        uses: crazy-max/ghaction-import-gpg@v6
        with:
          gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
          passphrase: ${{ secrets.PASSPHRASE }}
          git_user_signingkey: true
          git_commit_gpgsign: true
      -
        name: Deploy to GitHub Pages
        uses: crazy-max/ghaction-github-pages@v4
        with:
          target_branch: gh-pages
          build_dir: public
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Check availability of GitHub Pages

You can use the GitHub Status action along with this one to check the availability of GitHub Pages before deploying:

      -
        name: Check GitHub Pages status
        uses: crazy-max/ghaction-github-status@v3
        with:
          pages_threshold: major_outage
      -
        name: Deploy to GitHub Pages
        uses: crazy-max/ghaction-github-pages@v4
        with:
          target_branch: gh-pages
          build_dir: public
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Customizing

inputs

Following inputs can be used as step.with keys

Name Type Description
domain String Git domain (default github.com)
repo String GitHub repository where assets will be deployed (default $GITHUB_REPOSITORY)
target_branch String Git branch where assets will be deployed (default gh-pages)
keep_history Bool Create incremental commit instead of doing push force (default false)
allow_empty_commit Bool Allow an empty commit to be created (default true)
build_dir String Build directory to deploy (required)
absolute_build_dir Bool Whether to treat build_dir as an absolute path (defaults to false, making it relative to the working directory)
follow_symlinks Bool If enabled, the content of symbolic links will be copied (default false)
committer String Committer name and email address as Display Name <[email protected]> (defaults to the GitHub Actions bot user)
author String Author name and email address as Display Name <[email protected]> (defaults to the GitHub Actions bot user)
commit_message String Commit message (default Deploy to GitHub pages)
fqdn String Write the given domain name to the CNAME file
jekyll Bool Allow Jekyll to build your site (default true)
dry_run Bool If enabled, nothing will be pushed (default false)
verbose Bool Enable verbose output (default false)

environment variables

Following environment variables can be used as step.env keys

Name Description
GITHUB_TOKEN GITHUB_TOKEN as provided by secrets
GH_PAT Use a Personal Access Token if you want to deploy to another repo

Contributing

Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You can also support this project by becoming a sponsor on GitHub or by making a PayPal donation to ensure this journey continues indefinitely!

Thanks again for your support, it is much appreciated! πŸ™

License

MIT. See LICENSE for more details.

ghaction-github-pages's People

Contributors

crazy-max avatar dependabot-preview[bot] avatar dependabot[bot] avatar georgemarshall avatar github-actions[bot] avatar lkrzyzanek avatar miaowm5 avatar robin-rpr avatar sean-krail avatar sergeyzwezdin avatar yrd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ghaction-github-pages's Issues

Git history is overriden by the build process

Behaviour

I built a static site generator in python and use the git commit history of markdown files to display a "Last modified" date on the built website. When used locally, my build process works and display the date correctly.

But when I used this github action, the git history seems to disappear entirely and the date displayed is the built date,

Demo files

  1. You can see that this file last modification is may 24.
  2. But the built page shows May 29, the last time the site was built.

Expected behaviour

The date on the built page should be may 24.

Actual behaviour

The date on the built page is May 29,

Configuration

name: website

on: push

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Generate Chisai
        run: python3 src/build.py --prod
      #-
        #name: Create cname file
        # run: echo 'mydomain.com' > build/CNAME
      -
        name: Deploy to GitHub Pages
        if: success()
        uses: crazy-max/ghaction-github-pages@v2
        with:
          target_branch: gh-pages
          build_dir: build
          keep_history: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Logs

1_publish.txt

Thanks for your help.

fail to download action xxx

githubworkflowbug

I always see this warning, and this step takes a long time, I don’t know what caused the problem。
Is it a network problem?

Can't follow symlinks: ENOENT: no such file or directory, lstat 'filename'

Behaviour

Steps to reproduce this issue

  1. Generate files inside build_dir
  2. Create a symbolic link to a file within that same dir (analogous to running ln -s ./filename.tar.gz ./filename inside build_dir)
  3. Get the error from the title

Expected behaviour

Tell me what should happen

It should publish the symlinks (though I think GH pages does not support it) or copy the destination file/dir over the symlink before publishing.

Actual behaviour

Tell me what happens instead

I have two of such files, they all fail:

Cannot stat symlink rsa.db.tar.zst for  ./pkgs/rsa.db: Error: ENOENT: no such file or directory, lstat  'rsa.db.tar.zst'
Cannot stat symlink rsa.files.tar.zst for ./pkgs/rsa.files: Error: ENOENT: no such file or directory, lstat 'rsa.files.tar.zst' 

I ran ls -Ahl <build_dir> after generating such files, and it outputs the following:

Run ls -Ahl /__w/rsaur/rsaur/pkgs
total 3.5M
-rw-r--r-- 1 builduser builduser 1.4M Dec 30 08:58 chili-sddm-theme-0.1.5-1-x86_64.pkg.tar.zst
-rw-r--r-- 1 builduser builduser  86K Dec 30 08:58 gamemode-1.6-3-x86_64.pkg.tar.zst
-rw-r--r-- 1 builduser builduser 201K Dec 30 08:58 gamescope-3.7.1-1-x86_64.pkg.tar.zst
-rw-r--r-- 1 builduser builduser 761K Dec 30 09:00 gdm-nox-3.36.3-6-x86_64.pkg.tar.zst
-rw-r--r-- 1 builduser builduser  58K Dec 30 09:00 gnome-shell-extension-arch-update-git-38+3+gbe86f9e-1-any.pkg.tar.zst
-rw-r--r-- 1 builduser builduser  15K Dec 30 09:01 gnome-shell-extension-clock-override-git-5+47+g7a40543-1-any.pkg.tar.zst
-rw-r--r-- 1 builduser builduser 5.6K Dec 30 09:01 gnome-shell-extension-no-annoyance-git-r34.f6e7691-1-any.pkg.tar.zst
-rw-r--r-- 1 builduser builduser  12K Dec 30 08:58 lib32-gamemode-1.6-3-x86_64.pkg.tar.zst
-rw-r--r-- 1 builduser builduser 415K Dec 30 09:02 lib32-mangohud-0.6.1-2-x86_64.pkg.tar.zst
-rw-r--r-- 1 builduser builduser 118K Dec 30 09:00 libgdm-nox-3.36.3-6-x86_64.pkg.tar.zst
-rw-r--r-- 1 builduser builduser 405K Dec 30 09:02 mangohud-0.6.1-2-x86_64.pkg.tar.zst
-rw-r--r-- 1 builduser builduser 7.9K Dec 30 09:03 mangohud-common-0.6.1-2-x86_64.pkg.tar.zst
-rw-r--r-- 1 builduser builduser 6.6K Dec 30 09:03 nvidia-xrun-git-0.3.83.g270b6c0-1-x86_64.pkg.tar.zst
lrwxrwxrwx 1 root      root        14 Dec 30 09:03 rsa.db -> rsa.db.tar.zst
-rw-r--r-- 1 root      root      3.5K Dec 30 09:03 rsa.db.tar.zst
lrwxrwxrwx 1 root      root        17 Dec 30 09:03 rsa.files -> rsa.files.tar.zst
-rw-r--r-- 1 root      root      7.5K Dec 30 09:03 rsa.files.tar.zst

Configuration

Those are the exact commit and build that fail.

action .yml config here

Logs

Download the log file of your build and attach it to this issue.

log.txt

Beware that the log is very long.

Using fqdn to create the CNAME file doesn't work

I have this configuration:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Deploy GitHub Pages
        uses: crazy-max/ghaction-github-pages@v1
        with:
          build_dir: public
          fqdn: example.com
          target_branch: gh-pages
        env:
          # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          # https://github.community/t5/GitHub-Actions/Github-action-not-triggering-gh-pages-upon-push/td-p/26869/
          GITHUB_PAT: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

and I'm getting the following error:

βœ… Use GITHUB_PAT
πŸƒ Initializing local git repo
git init .
Initialized empty Git repository in /tmp/github-pages-p0j0xG/.git/
git checkout --orphan gh-pages
Switched to a new branch 'gh-pages'
πŸƒ Copying /home/runner/work/repo/repo/public contents to /tmp/github-pages-p0j0xG
✍️ Writing example.com domain name to public/CNAME
##[error]ENOENT: no such file or directory, open 'public/CNAME'
##[error]Node run failed with exit code 1

I'm pretty sure that path.join(build_dir, 'CNAME') (https://github.com/crazy-max/ghaction-github-pages/blob/master/src/main.ts#L59) needs to be path.join(tmpdir, 'CNAME')

git exits with 128 in my action

Behaviour

Steps to reproduce this issue

  1. In the repo https://github.com/asm0dey/kotlin-spring-webinar
  2. On the "Deploy pages step"
  3. I get the following log:
  ##[debug]Force push
  /usr/bin/git push --force ***github.com/asm0dey/kotlin-spring-webinar.git gh-pages
  remote: Permission to asm0dey/kotlin-spring-webinar.git denied to github-actions[bot].
  fatal: unable to access 'https://github.com/asm0dey/kotlin-spring-webinar.git/': The requested URL returned error: 403
  Error: The process '/usr/bin/git' failed with exit code 128
  ##[debug]Node Action run completed with exit code 1
  ##[debug]Finishing: Deploy pages

Expected behaviour

should be published successfully

Configuration

name: Deploy pages
on: push
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '19'
      - name: Install dependencies
        run: npm install
      - name: Install slidev
        run:  npm i -g @slidev/cli
      - name: Build
        run: slidev build --base kotlin-spring-webinar
      - name: Deploy pages
        uses: crazy-max/ghaction-github-pages@v3
        with:
          build_dir: dist
          target_branch: gh-pages
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Document enabling `gh-pages` and `.nojekyll`

https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#static-site-generators explains

If you want to use a static site generator other than Jekyll, disable the Jekyll build process by creating an empty file called .nojekyll in the root of your publishing source, then follow your static site generator's instructions to build your site locally.

It would be really helpful to have this documented prominently on your readme!

And also to explain whether you need to go to https://github.com/you/repo/settings/pages to enable it or if it will Just Work once you run this Action.

Deleted files not removed when keep_history: true

Behaviour

With keep_history: true, deleting a folder does not push file deletions to the remote repository.

Steps to reproduce this issue

Configure action with: keep_history: true

  1. Push to gh_pages
    /a/file.txt
    /b/file.txt
    
  2. Remove files/directory from parent repository
       /a/file.txt
     - /b/file.txt
    
  3. Push to gh_pages

Expected behaviour

gh_pages repo/branch does not contain directory b/

Actual behaviour

Directory b/ still present

Configuration

name: "Cleanup Preview"

on:
  pull_request:
    types: [ closed ]

env:
  GITHUB_PR_NUMBER: "${{github.event.number}}"

jobs:
  cleanup:
    runs-on: ubuntu-latest
    steps:
    - name: Pull release
      uses: actions/checkout@v2
      with:
        repository: ysndr/beta
        ref: gh-pages
        path: preview

    - name: Remove Preview
      run: |
        ls -la
        [ -d preview/${{ env.GITHUB_PR_NUMBER }} ] && rm -r preview/${{ env.GITHUB_PR_NUMBER }}
        ls -la

        rm  -rf preview/.git


    - name: Push
      uses: crazy-max/ghaction-github-pages@v2
      with:
        repo: ysndr/beta
        target_branch: gh-pages
        build_dir: ./preview
        committer: github-ci <[email protected]>
        verbose: true
       keep_history: true
      env:
        GH_PAT: ${{ secrets.DEPLOY_TOKEN }}

Logs

logs_65.zip

Allow override git domain

The git server's url is hardcoded to github.com (see source) which is fine for github usage however it would be cool to have possibility to override this default value via e.g. env variable GIT_DOMAIN.
This would makes the script even more universal and could be used for private's git servers.

EEXIST: file already exists

Behaviour

When I am deploying a directory I am getting this error:

EEXIST: file already exists, mkdir '/tmp/github-pages-3fqEIE/lib/absinthe/priv'

I am using mix (elixir's build tool) to build a release. After running, mix will create a _build/prod directory with all the files needed to run the app.

Expected behaviour

Deploys as usual

Actual behaviour

Error: EEXIST: file already exists, mkdir '/tmp/github-pages-3fqEIE/lib/absinthe/priv'

Configuration

name: Deploy
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Setup Elixir
        uses: actions/[email protected]
        with:
          otp-version: 22.x
          elixir-version: 1.9.x
      - name: Install Deps
        run: mix deps.get
      - name: Lint
        run: |
          mix format --check-formatted
          mix credo --ignore readability --strict
      - name: Test
        run: mix test --cover
        env:
          MIX_ENV: test
      - name: Build Relase
        if: success()
        run: mix release
        env:
          TC_PUBLIC_API_KEY: ${{ secrets.TC_PUBLIC_API_KEY }}
          TC_PRIVATE_API_KEY: ${{ secrets.TC_PRIVATE_API_KEY }}
          MIX_ENV: prod
      - name: Deploy
        if: success()
        uses: crazy-max/ghaction-github-pages@v2
        with:
          target_branch: production
          build_dir: _build/prod
          keep_history: true
          allow_empty_commit: false
          commit_message: "Production deploy"
          jekyll: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Logs

logs_9.zip

Weird malformed URL

I tried to make an auto jsdoc build and deployement workflow using this tool but when your tool was running it tried to connect to https://***/github.com instead of https://github.com.
malformated url
You can check my worflow on my repo arthuro555/gdevelop-server to see if the error comes from me.

Able to destroy main/master

Behaviour

Wipes branch by default.

Steps to reproduce this issue

  1. Install action
  2. Use it as follows
  3. Default overwrites main/master :(

Expected behaviour

Tell me what should happen

A new push should be created

Actual behaviour

Tell me what happens instead

A force push destroys the history and the GitHub workflow that ran it!

Configuration

YML File below.

  • Repository URL (if public): N/A
  • Build URL (if public): N/A

This needs to have a warning. The action should not destroy the commit history by default. Luckily GitHub support was able to recover my last commit.

Example:

name: Snake

on:
  # run automatically every 6 hours
  schedule:
    - cron: "0 */6 * * *"

# This command allows us to run the Action automatically from the Actions tab.
  workflow_dispatch:
  
  push:
    branches:
    - master

jobs:
  generate:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    
    steps:
      # generates a snake game from a github user (<github_user_name>) contributions graph, output a svg animation at <svg_out_path>
      - name: generate github-contribution-grid-snake.svg
        uses: Platane/snk/svg-only@v2
        with:
          github_user_name: ${{ github.repository_owner }}
          outputs: |
            snake/github-contribution-grid-snake.svg?color_snake=purple
            snake/github-contribution-grid-snake-dark.svg?palette=github-dark&color_snake=purple
      # push the content of <build_dir> to a branch
      # the content will be available at https://raw.githubusercontent.com/<github_user>/<repository>/<target_branch>/<file> , or as github page
      - name: push github-contribution-grid-snake.svg to the output branch
        uses: crazy-max/[email protected]
        with:
          target_branch: master
          build_dir: dist
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Logs

https://github.com/Technetium1/Technetium1/actions/runs/2593974297

See also Platane/snk#36

fatal: empty ident name (for <[email protected]>) not allowed

Behaviour

Steps to reproduce this issue

https://github.com/SummerSec/SummerSec/actions/runs/3358344524/jobs/5565173197
https://github.com/SummerSec/SummerSec/actions/runs/3358344524/workflow
2.
3.

Expected behaviour

Tell me what should happen

Actual behaviour

Tell me what happens instead

Configuration

  • Repository URL (if public):
  • Build URL (if public):
# paste your YAML workflow file here and remove sensitive data

Logs

image

Download the log file of your build
and attach it to this issue.

Parallel jobs causes randomly gh pages push failure

Behaviour

Steps to reproduce this issue

Parallel jobs causes randomly gh pages push failure:

Pushing public directory to main branch on ... repo
  /usr/bin/git push https://***@github.com/***.git main
  To https://github.com/***.git
   ! [rejected]        main -> main (fetch first)
  error: failed to push some refs to 'https://github.com/***.git'
  hint: Updates were rejected because the remote contains work that you do
  hint: not have locally. This is usually caused by another repository pushing
  hint: to the same ref. You may want to first integrate the remote changes
  hint: (e.g., 'git pull ...') before pushing again.
  hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  Error: The process '/usr/bin/git' failed with exit code 1

Expected behaviour

Succesful push

Actual behaviour

failures

error: failed to push some refs to ...
  hint: Updates were rejected because the remote contains work that you do
  hint: not have locally. 

I think library should have some kind of retry mechanism for this case

error: src refspec gh-pages does not match any.

Hiya,

I am running into the following error and I haven't been able to determine why:

error: src refspec gh-pages does not match any.
error: failed to push some refs to 'https://MitchTalmadge:As provided by GitHub [email protected]/MitchTalmadge/CleanTweets.git'
##[error]Docker run failed with exit code 1

The odd part to me is the "As provided by GitHub Actions" found in the URL... I know for certain that the PAT secret I am using does contain a personal access token, not anything like that.

The full build logs are found here.

Here is my workflow:

name: Web Frontend

on: 
  push:
    branches: 
      - master

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - uses: actions/[email protected]
    - name: Install
      run: npm --prefix web install
    - name: Build
      if: success()
      run: npm --prefix web run build
    - name: Deploy
      if: success()
      uses: crazy-max/[email protected]
      env:
        GITHUB_PAT: ${{ secrets.GH_PAT }}
      with:
        build_dir: web/dist

The branch does exist in my repo:
image

Thanks for any suggestions.

Allow absolute paths for the `build_dir` option

Could you please add an option to make this path.join optional?

await copy(path.join(currentdir, buildDir), tmpdir, {

The reason is that I would like to deploy a folder built with Nix. When Nix builds something, the output lands in a central store under /nix/store and the output which gets placed in the current directory is a symlink to the store location. Since the build_dir option needs a relative path, I end up having to work around this problem by prepending it with ../../../../../, which is kind of ugly. It works for now, but I would prefer to be able to provide an absolute path (or even better, just be able to provide the symlink, but that doesn't seem to work because the copy function doesn't want to overwrite a folder with a symlink).

Thanks!

Error: Cannot overwrite directory with non-directory

Hi, first all, thanks for this action to make me be more focused on writing posts, not for spend so much time to maintaining the deploy scripts

Behaviour

Pushed code, actions build exit successfully but report: Error: Cannot overwrite directory '/tmp/xxx' with non-directory '/home/runner/work/xxx'

Steps to reproduce this issue

  1. Making some changes
  2. Push to repository
  3. GitHub Actions building...

Expected behaviour

The gh-pages branch should contain builded site

Actual behaviour

GitHub actions report the error: Error: Cannot override directory '/tmp/xxx' with non-directory '/home/runner/work/xxx'

Configuration

# paste your YAML workflow file here and remove sensitive data
- uses: crazy-max/ghaction-github-pages@v2
  if: success()
  with:
    verbose: true
    build_dir: site
    target_branch: gh-pages
    keep_history: true
  env:
    GITHUB_TOKEN: ${{ secrets.TOKEN }}

Logs

2021-09-29T03:09:11.9604280Z ##[group]Run crazy-max/ghaction-github-pages@v2
2021-09-29T03:09:11.9604921Z with:
2021-09-29T03:09:11.9605294Z   verbose: true
2021-09-29T03:09:11.9605703Z   build_dir: site
2021-09-29T03:09:11.9606157Z   target_branch: gh-pages
2021-09-29T03:09:11.9606614Z   keep_history: true
2021-09-29T03:09:11.9607057Z   domain: github.com
2021-09-29T03:09:11.9607541Z   allow_empty_commit: true
2021-09-29T03:09:11.9607966Z   jekyll: true
2021-09-29T03:09:11.9608361Z   dry_run: false
2021-09-29T03:09:11.9608718Z env:
2021-09-29T03:09:11.9610179Z   GITHUB_TOKEN: ***
2021-09-29T03:09:11.9610623Z ##[endgroup]
2021-09-29T03:09:12.3716308Z ##[group]Cloning c4dr01d/c4dr01d.github.io
2021-09-29T03:09:12.3750901Z [command]/usr/bin/git clone --quiet --branch gh-pages --depth 1 ***github.com/c4dr01d/c4dr01d.github.io.git .
2021-09-29T03:09:12.8148526Z ##[endgroup]
2021-09-29T03:09:12.8157710Z ##[group]Copying /home/runner/work/c4dr01d.github.io/c4dr01d.github.io/site to /tmp/github-pages-3IjFT9
2021-09-29T03:09:12.8180535Z ##[error]Error: Cannot overwrite directory '/tmp/github-pages-3IjFT9' with non-directory '/home/runner/work/c4dr01d.github.io/c4dr01d.github.io/site'.
2021-09-29T03:09:12.8194358Z 0 file(s) copied.
2021-09-29T03:09:12.8195704Z ##[endgroup]
2021-09-29T03:09:12.8267307Z No changes to commit

Newly generated file not included in commit

I have a directory website/ with my full jekyll site, but I generate the index.md file before I want to publish:

      - uses: actions/[email protected]
      - uses: actions/checkout@v2
      - run: npm install
      - run: npm run build-website
      - run: ls -la website/
      - name: GitHub Pages
        uses: crazy-max/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          build_dir: website

It properly deploys the site to gh-pages but it is missing the generated index.md file from the npm run build-website step.
I added a ls -la website/ right after and the file is there:

image

Do you have an idea what might be going on here?

Keeping history even with keep_history: false

I may be misinterpretting what keep_history: false is supposed to do, but it doesn't seem to be doing it, even when I set is explicitly.

It is my understanding that it's supposed to get rid of any old commits on the target branch, so that the target branch only ever has one commit at a time. This is the desired behaviour for me, as my compiled material is quite large and will quickly take up a lot of space.

But my target branch is accumulating commits each time the action runs, as you can see here and here. This is my configuration (identical for both repos):

if: success()
uses: crazy-max/ghaction-github-pages@v1
with:
  target_branch: gh-pages
  build_dir: website
  keep_history: false
env:
  GITHUB_PAT: ${{ secrets.GITHUB_PAT }}```

Exit successfully on empty commit

Is your feature request related to a problem? Please describe
If I disable the option allow_empty_commit, then every time when I update my workflow file (or any other file not related to website), deploy is triggered and I get an error because there is no changes in website.

Describe the solution you'd like
It would be great to exit the action successfully with an empty commit, because if I activate the continue-on-error option, the action will complete successfully with any other error, which is not safe.

Describe alternatives you've considered
This behavior could be optional with the additional parameter or allow_empty_commit could be an enumeration with the third option like skip.

Push to remote repo does not work

Behaviour

Steps to reproduce this issue

It seems that github changed something and push to the remote repository stopped working.
image

Expected behaviour

Tell me what should happen

Actual behaviour

Tell me what happens instead

Configuration

  • Repository URL (if public):
  • Build URL (if public):
    - name: Deploy WebAssembly to other repository GitHub Pages
      if: inputs.deploy-web-assembly-path != '' &&
          env.CONVENTIONAL-COMMITS-PUBLISH-CONDITIONS == 'true' &&
          inputs.deploy-web-assembly-repo != ''
      uses: crazy-max/ghaction-github-pages@v2
      with:
        target_branch: gh-pages
        build_dir: ${{ inputs.deploy-web-assembly-path }}
        repo: ${{ inputs.deploy-web-assembly-repo }}
        jekyll: false
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GH_PAT: ${{ secrets.personal-token }}

Logs

Download the log file of your build
and attach it to this issue.

How to set a custom domain during build and deployment?

Thanks for this handy action!

I wonder whether it's possible to run the action with a custom domain.
At the moment, after each deployment, I need to go to the settings to add the custom domain, which will result in a new commit on the gh-pages branch that will add the CNAME file.

I see in the documentation the domain input, but I am not sure if this is indeed the one I am looking for.

Name Type Description
domain String Git domain (default github.com)

Git Permissions Issue

Hey there Crazy Max. I'm trying to publish the contents of my build folder using this action. Here's my configuration:

name: Publish
uses: crazy-max/ghaction-github-pages@v1
with:
  target_branch: gh-pages
  build_dir: build
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

When I get to the publish action, I run into this error:

πŸƒ Deploying build directory to gh-pages branch on LandonSchropp/landonschropp.com repo
git init
/home/runner/work/landonschropp.com/landonschropp.com/build/.git: Permission denied
##[error]The process 'git' failed with exit code 1
##[error]Node run failed with exit code 1

It looks like the error is happening here. However, I can't figure out why the build directory would have any weird permissions. Did the action somehow get pointed the wrong place? Any ideas?

Thanks in advance!

Keeps history even with keep_history:false

Hi,
first, many thanks for this useful action. For some reason, I encounter the following issue that seems to be the same as #27, but with @v2.

Behaviour

The history of the gh-action branches is kept and commits are added incrementally.

Steps to reproduce this issue

  1. set up a step with keep_history: false or leaving it as default

Expected behaviour

According to how I understand the keep_history option, a new root commit without history should be force-pushed to the gh-action branch.

Actual behaviour

The history of the gh-action branch is kept and a new commit is appended. The logs shows the "Initializing local git repo" so the correct code branch is taken, but for some reason the history is available anyway(??!)

Configuration

Config:

      - name: Deploy to GitHub Pages
        uses: crazy-max/ghaction-github-pages@v2
        with:
          build_dir: doc/_build/html
          commit_message: Build documentation from ${{ github.ref }}@${{ github.sha }}
          keep_history: false
          jekyll: false
        env:
          GITHUB_TOKEN: ${{ github.token }}

Logs

See https://github.com/hibtc/cpymad/suites/2542747788/logs, relevant part:

2021-04-20T19:51:17.0734174Z ##[group]Run make -C doc html
2021-04-20T19:51:17.0734723Z οΏ½[36;1mmake -C doc htmlοΏ½[0m
2021-04-20T19:51:17.0776684Z shell: /usr/bin/bash -e {0}
2021-04-20T19:51:17.0777116Z env:
2021-04-20T19:51:17.0777715Z   pythonLocation: /opt/hostedtoolcache/Python/3.9.4/x64
2021-04-20T19:51:17.0778537Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.4/x64/lib
2021-04-20T19:51:17.0779131Z ##[endgroup]
2021-04-20T19:51:17.0886030Z make: Entering directory '/home/runner/work/cpymad/cpymad/doc'
2021-04-20T19:51:17.0911440Z sphinx-build -b html -d _build/doctrees   . _build/html
2021-04-20T19:51:17.4751042Z Running Sphinx v3.5.4
2021-04-20T19:51:17.7485254Z building [mo]: targets for 0 po files that are out of date
2021-04-20T19:51:17.7486747Z building [html]: targets for 14 source files that are out of date
2021-04-20T19:51:17.7497774Z updating environment: [new config] 14 added, 0 changed, 0 removed
2021-04-20T19:51:17.7498750Z reading sources... [  7%] building
2021-04-20T19:51:17.7978636Z reading sources... [ 14%] cpymad/index
2021-04-20T19:51:17.8037122Z reading sources... [ 21%] cpymad/libmadx
2021-04-20T19:51:18.2414855Z reading sources... [ 28%] cpymad/madx
2021-04-20T19:51:18.5807918Z reading sources... [ 35%] cpymad/types
2021-04-20T19:51:18.6121798Z reading sources... [ 42%] cpymad/util
2021-04-20T19:51:18.7107052Z reading sources... [ 50%] getting-started
2021-04-20T19:51:18.7439975Z reading sources... [ 57%] index
2021-04-20T19:51:18.7700194Z reading sources... [ 64%] installation
2021-04-20T19:51:18.7788902Z reading sources... [ 71%] installation/macos
2021-04-20T19:51:18.8304322Z reading sources... [ 78%] installation/troubleshooting
2021-04-20T19:51:18.8658443Z reading sources... [ 85%] installation/unix
2021-04-20T19:51:18.8855518Z reading sources... [ 92%] installation/windows
2021-04-20T19:51:18.9174607Z reading sources... [100%] known-issues
2021-04-20T19:51:18.9242814Z 
2021-04-20T19:51:18.9244476Z looking for now-outdated files... none found
2021-04-20T19:51:18.9269529Z pickling environment... done
2021-04-20T19:51:18.9270163Z checking consistency... done
2021-04-20T19:51:18.9376528Z preparing documents... done
2021-04-20T19:51:18.9377088Z writing output... [  7%] building
2021-04-20T19:51:19.0554705Z writing output... [ 14%] cpymad/index
2021-04-20T19:51:19.0738591Z writing output... [ 21%] cpymad/libmadx
2021-04-20T19:51:19.1723831Z writing output... [ 28%] cpymad/madx
2021-04-20T19:51:19.2897633Z writing output... [ 35%] cpymad/types
2021-04-20T19:51:19.3121172Z writing output... [ 42%] cpymad/util
2021-04-20T19:51:19.3475729Z writing output... [ 50%] getting-started
2021-04-20T19:51:19.3964727Z writing output... [ 57%] index
2021-04-20T19:51:19.4610896Z writing output... [ 64%] installation
2021-04-20T19:51:19.4846832Z writing output... [ 71%] installation/macos
2021-04-20T19:51:19.5158515Z writing output... [ 78%] installation/troubleshooting
2021-04-20T19:51:19.5592462Z writing output... [ 85%] installation/unix
2021-04-20T19:51:19.5915761Z writing output... [ 92%] installation/windows
2021-04-20T19:51:19.6871761Z writing output... [100%] known-issues
2021-04-20T19:51:19.7029834Z 
2021-04-20T19:51:19.7425452Z generating indices... genindex py-modindex done
2021-04-20T19:51:19.7426871Z highlighting module code... [ 20%] cpymad.libmadx
2021-04-20T19:51:19.7428169Z highlighting module code... [ 40%] cpymad.madx
2021-04-20T19:51:19.8311756Z highlighting module code... [ 60%] cpymad.types
2021-04-20T19:51:19.8433016Z highlighting module code... [ 80%] cpymad.util
2021-04-20T19:51:19.8861006Z highlighting module code... [100%] posix
2021-04-20T19:51:19.8861418Z 
2021-04-20T19:51:19.9031079Z writing additional pages... search done
2021-04-20T19:51:19.9262054Z copying static files... done
2021-04-20T19:51:19.9263462Z copying extra files... done
2021-04-20T19:51:19.9326648Z dumping search index in English (code: en)... done
2021-04-20T19:51:19.9342139Z dumping object inventory... done
2021-04-20T19:51:19.9342802Z build succeeded.
2021-04-20T19:51:19.9343153Z 
2021-04-20T19:51:19.9343917Z The HTML pages are in _build/html.
2021-04-20T19:51:20.0790804Z 
2021-04-20T19:51:20.0802017Z Build finished. The HTML pages are in _build/html.
2021-04-20T19:51:20.0804681Z make: Leaving directory '/home/runner/work/cpymad/cpymad/doc'
2021-04-20T19:51:20.0998926Z ##[group]Run crazy-max/ghaction-github-pages@v2
2021-04-20T19:51:20.0999503Z with:
2021-04-20T19:51:20.0999878Z   build_dir: doc/_build/html
2021-04-20T19:51:20.1000691Z   commit_message: Build documentation from refs/heads/master@e0c1e858818737eda5bb2e4654800afda3007001
2021-04-20T19:51:20.1001465Z   jekyll: false
2021-04-20T19:51:20.1001867Z   domain: github.com
2021-04-20T19:51:20.1002304Z   target_branch: gh-pages
2021-04-20T19:51:20.1002852Z   keep_history: false
2021-04-20T19:51:20.1003274Z   allow_empty_commit: true
2021-04-20T19:51:20.1003661Z env:
2021-04-20T19:51:20.1004191Z   pythonLocation: /opt/hostedtoolcache/Python/3.9.4/x64
2021-04-20T19:51:20.1004939Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.4/x64/lib
2021-04-20T19:51:20.1006539Z   GITHUB_TOKEN: ***
2021-04-20T19:51:20.1006933Z ##[endgroup]
2021-04-20T19:51:20.3564284Z ✨ Initializing local git repo
2021-04-20T19:51:20.3704317Z πŸƒ Copying /home/runner/work/cpymad/cpymad/doc/_build/html contents to /tmp/github-pages-SGmq7P
2021-04-20T19:51:20.4140595Z 🚫 Disabling Jekyll support via /tmp/github-pages-SGmq7P/.nojekyll
2021-04-20T19:51:20.4839302Z πŸ”¨ Configuring git committer as GitHub <[email protected]>
2021-04-20T19:51:20.5644320Z πŸ“ Updating index of working tree
2021-04-20T19:51:20.6967440Z ##[group]πŸ“¦ Committing changes as github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> author
2021-04-20T19:51:20.8057824Z commit 22ec919a7157a45e98da4cd55c0e147423bd48a0
2021-04-20T19:51:20.8060071Z Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-04-20T19:51:20.8061150Z Date:   Tue Apr 20 19:51:20 2021 +0000
2021-04-20T19:51:20.8061776Z 
2021-04-20T19:51:20.8063063Z     Build documentation from refs/heads/master@e0c1e858818737eda5bb2e4654800afda3007001
2021-04-20T19:51:20.8063973Z 
2021-04-20T19:51:20.8065179Z  .buildinfo                            |   2 +-
2021-04-20T19:51:20.8066202Z  _static/basic.css                     |  23 ++++++++++++++---------
2021-04-20T19:51:20.8067515Z  _static/fonts/Inconsolata-Bold.ttf    | Bin 0 -> 109948 bytes
2021-04-20T19:51:20.8068952Z  _static/fonts/Inconsolata-Regular.ttf | Bin 0 -> 96964 bytes
2021-04-20T19:51:20.8070272Z  _static/fonts/Inconsolata.ttf         | Bin 0 -> 63184 bytes
2021-04-20T19:51:20.8071529Z  _static/fonts/Lato-Bold.ttf           | Bin 0 -> 656544 bytes
2021-04-20T19:51:20.8072712Z  _static/fonts/Lato-Regular.ttf        | Bin 0 -> 656568 bytes
2021-04-20T19:51:20.8074020Z  _static/fonts/RobotoSlab-Bold.ttf     | Bin 0 -> 170616 bytes
2021-04-20T19:51:20.8075384Z  _static/fonts/RobotoSlab-Regular.ttf  | Bin 0 -> 169064 bytes
2021-04-20T19:51:20.8076538Z  index.html                            |   2 +-
2021-04-20T19:51:20.8077463Z  searchindex.js                        |   2 +-
2021-04-20T19:51:20.8078545Z  11 files changed, 17 insertions(+), 12 deletions(-)
2021-04-20T19:51:20.8080034Z ##[endgroup]
2021-04-20T19:51:20.8081348Z πŸƒ Pushing doc/_build/html directory to gh-pages branch on hibtc/cpymad repo
2021-04-20T19:51:23.1200384Z πŸŽ‰ Content of doc/_build/html has been deployed to GitHub Pages
2021-04-20T19:51:23.1300757Z Post job cleanup.
2021-04-20T19:51:23.2506013Z [command]/usr/bin/git version
2021-04-20T19:51:23.2556104Z git version 2.31.1
2021-04-20T19:51:23.2591490Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2021-04-20T19:51:23.2629523Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
2021-04-20T19:51:23.2895187Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2021-04-20T19:51:23.2924848Z http.https://github.com/.extraheader
2021-04-20T19:51:23.2934087Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2021-04-20T19:51:23.2972241Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
2021-04-20T19:51:23.3324688Z Post job cleanup.
2021-04-20T19:51:23.4349769Z [command]/usr/bin/git version
2021-04-20T19:51:23.4403281Z git version 2.31.1
2021-04-20T19:51:23.4446419Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2021-04-20T19:51:23.4488021Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
2021-04-20T19:51:23.4737883Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2021-04-20T19:51:23.4766796Z http.https://github.com/.extraheader
2021-04-20T19:51:23.4777489Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2021-04-20T19:51:23.4813987Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
2021-04-20T19:51:23.5109115Z Cleaning up orphan processes

File already exists error

Behaviour

When deploying a directory with this action, I am getting the error:

##[error]EEXIST: file already exists, symlink '/home/runner/.cache/bazel/_bazel_runner/17d8e9b30b69e9aeac686c3673f39b5a/execroot/highschool_notes/bazel-out/k8-fastbuild/bin' -> '/tmp/github-pages-vbZ3SF'

For clarification, I am using the bazel buildsystem and pandoc to generate some HTML outputs from LaTeX files. After running, Bazel creates the following symlinks in the workspace directory:

bazel-bin -> /home/runner/.cache/bazel/_bazel_runner/17d8e9b30b69e9aeac686c3673f39b5a/execroot/highschool_notes/bazel-bin
bazel-highschool_notes -> /home/runner/.cache/bazel/_bazel_runner/17d8e9b30b69e9aeac686c3673f39b5a/execroot/highschool_notes/bazel-highschool_notes
bazel-out -> /home/runner/.cache/bazel/_bazel_runner/17d8e9b30b69e9aeac686c3673f39b5a/execroot/highschool_notes/bazel-out
bazel-testlogs -> /home/runner/.cache/bazel/_bazel_runner/17d8e9b30b69e9aeac686c3673f39b5a/execroot/highschool_notes/bazel-testlogs

I would expect that this just deploys as per usual (I have no problems in many other projects)

Configuration

  • Repository URL (if public):
  • Build URL (if public):
name: Deploy docs

on:
  push:
    branches:
      - master
 
jobs:
  
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Install bazelisk
        run: |
          curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.1.0/bazelisk-linux-amd64"
          mkdir -p "${GITHUB_WORKSPACE}/bin/"
          mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
          chmod +x "${GITHUB_WORKSPACE}/bin/bazel"

      - name: Install pandoc
        run: |
          sudo apt install pandoc texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra -y

      - name: Build
        run: |
          "${GITHUB_WORKSPACE}/bin/bazel" clean
          "${GITHUB_WORKSPACE}/bin/bazel" build //:all

      - name: Check GitHub Pages status
        uses: crazy-max/ghaction-github-status@v1
        with:
          pages_threshold: major_outage

      - name: Deploy to GitHub Pages
        if: success()
        uses: crazy-max/ghaction-github-pages@v2
        with:
          target_branch: gh-pages
          build_dir: bazel-bin
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Logs

logs_7.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.