question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to add `dist/` directory?

See original GitHub issue

Check list before opening this issue

Describe your question

  • My project file tree:
my-repository/
|- index.html ... entrypoint
|- src/ ... source codes
|- dist/ ... created by `$ npm run build`
  • .gitignore
node_modules/

dist/

index.html is located in project root directory. So I want to upload to gh-pages like this:

https://example.github.io/my-repository/index.html
https://example.github.io/my-repository/dist/bundle.js

Therefore, I wrote workflows like this:

name: Deploy To GitHub Pages
on:
  push:
    branches:
      - master
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Use Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 12.x
      - name: Install
        run : npm install
      - name: Build
        run : npm run build
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: '.'
          # to include `./index.html`

I expected to include dist/. But dist/ did not include because dist/ is specified in .gitignore.

How to include dist/ in gh-pages?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
peaceiriscommented, Feb 18, 2021

You can create a new directory (e.g. public), move index.html and dist into public, and set publish_dir: 'public'.

      - name: Build
        run : npm run build
      - name: Create public
        run: |
          mkdir public
          mv ./index.html ./dist ./public
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: 'public'
0reactions
github-actions[bot]commented, Jun 25, 2021

This issue has been LOCKED because of it being resolved!

The issue has been fixed and is therefore considered resolved. If you still encounter this or it has changed, open a new issue instead of responding to solved ones.

<div align="right">Log | Bot Usage</div>
Read more comments on GitHub >

github_iconTop Results From Across the Web

npm install doesnt create dist folder - Stack Overflow
Am I missing a step here or am I understanding something incorrect? Since I expected that command to create a dist/ folder out...
Read more >
Generate dist folder from source code · Issue #892 - GitHub
If you don't have the dist folder already, you just need to run npm install and npm run build to generate the dist...
Read more >
Webpack: Creating a custom structure for the 'dist' directory
In this video, we will find out how to create a custom structure for the webpack's ' dist ' directory. There will also...
Read more >
Dist directory - Nuxt
The dist folder, short for distribution folder, is dynamically generated when using the nuxt generate commands and includes the generated production ready ...
Read more >
What is the role of src and dist folders in JavaScript/jQuery
The /dist stands for distributable. · The /dist folder contains the minimized version of the source code. · The code present in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found