ShaSha
ShaSha

Reputation: 699

auto deploying static nuxt js project with github action

Hi i created a repository with the same name of my github account called mortezasabihi. and in this repository i pushed my personal website (nuxtjs static) to it and created github action for autodeployment, but I don't know why my github page URL is this: enter image description here

I want to be https://mortezasabihi.github.io.

this is my gh action:

  
name: cd

on: [push, pull_request]

jobs:
  cd:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [ubuntu-latest]
        node: [14]

    steps:
      - name: Checkout
        uses: actions/checkout@master

      - name: Setup node env
        uses: actions/setup-node@v2.1.2
        with:
          node-version: ${{ matrix.node }}

      - name: Install dependencies
        run: yarn

      - name: Generate
        run: yarn run generate

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./dist

what's wrong? I didn't understand!

Upvotes: 0

Views: 656

Answers (2)

Iman Shafiei
Iman Shafiei

Reputation: 1637

I have my personal website on Github pages too, and use this strategy:

I create a branch named development and working on that branch.

Based on Nuxt documentation, I add some script in my package.json file:

"scripts": {
    "dev": "nuxt",
    "generate": "nuxt generate",
    "start": "nuxt start",
    "deploy": "push-dir --dir=dist --branch=master --cleanup"
},

and when running these commands, the dist folder automatically will be pushed to master.

npm run generate
npm run deploy

Upvotes: 0

GuiFalourd
GuiFalourd

Reputation: 23338

The own action-gh-pages documentation allows you to configure many things inside your workflow file.

You can have one site published to https://<username>.github.io by publishing to the master (or main) branch of a repository named “username.github.io” (substituting your actual username), as explained here.

You can also have an additional site per GitHub project published to https://<username>.github.io/<project> (which seems to be what you did here using your username profile repository).

Project sites will publish whatever you push to the gh-pages branch by default, but you can change the publishing source in the repository settings.

Another description is available in the GitHub Pages documentation, including options for using custom domain names.

Upvotes: 2

Related Questions