GitHub page shows readme file instead of index.html but works only if mentioned full path to html file - github

I am new to this and I would really need some help. I am trying to deploy my GitHub page from my GitHub repository. I have set the gh-pages branch as my default, I put the code in there.
The code is in here: https://github.com/MelisaBogdan/melisabogdan.github.io
I tried to check if the website is visible with this link https://melisabogdan.github.io but all I see is the readme file. BUT I can perfectly see it by mentioning the folders https://melisabogdan.github.io/root/index.html
I know that many people managed to have their website visible without mentioning the full path ( by simply typing https://melisabogdan.github.io).
Is there anything I can do? I would really appreciate some help I tried what some other people suggested....

Since this is a NodeJS based site, there are many things that you need to do. Do the following steps to see your portfolio at https://melisabogdan.github.io/ . Basically you need to setup a GitHub action in your repository which runs the NodeJS code & then puts the static HTML/CSS files in your gh-pages branch.
Change your default branch to master by going to your_repo > settings > Branches (on left tab) > Default branch
Create a folder .github (include that dot) in the master branch
create a folder workflows within this folder
create a file deploy.yml inside workflows folder
Put the following code in deploy.yml
name: Build and Deploy
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout#v2.3.1
with:
persist-credentials: false
- name: Install and Build 🔧
run: |
npm install
npm run build
- name: Deploy 🚀
uses: peaceiris/actions-gh-pages#v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
So finally the folder structure should be like:
melisabogdan.github.io/.github/workflows/deploy.yml
Now commit these files to GitHub
Now if you go to the actions tab in your repo, should see an action running. It will take 2-3 mins & then finally, you should be able to see your site at https://melisabogdan.github.io/

Related

Building static assets into `./doc` folder of Github pages is not working

I have been using Github pages with a custom domain putting all assets including index.html in the root folder of the repository.
Setting the project to be deployed using Github pages at first; All went well with the default action; index.html was served and everything was functional.
Now because I'm trying to modularize and clean the project, nothing is left in the root folder except the necessary build configuration files (along with source).
Locally npm run build part of my build process works fine. I can then serve files from docs folder (because Github uses either root or docs folder) my bundle goes to docs; So I also changed that configuration in Github pages:
(The DNS check goes green after seconds.)
So I defined a NodeJS action to replicate my local build process as:
name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout#v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
My actions page shows this order:
I assume that build is done before Github pages does its internal configurations.
I also made sure the CNAME file is still there (/docs) after each build.
Is using (/docs) folder fine to serve the static site ? same as root ?
and is my action being run before Github pages comes into place ?
For reference: my site is inaccessible: https://mylinks.space/
The last thing I can thing of is that because the site is served from a different folder, now CNAME file needs time to be propagated (DNS checking).
#jonrsharpe: That was it.
For reference: a solution here is to make another branch, add the folder (not ignored) and push that only folder to that branch, for example "gh-pages" branch.
That's a perfect solution for this particular case. I had to remove the folder again from "main" branch though. You can automate the process of git commands with a script.
This is the process for my case: (docs in .gitignore)
Manuel build locally each time
Then
git add docs
git subtree push --prefix docs origin gh-pages
git rm -r docs && git commit -m "Initial dist subtree commit"
git push

Travis-CI will not build a new GitHub Repo

I created a new repo on github and added the .travis.yml file and some sphinx documents but travis won't trigger a build. I can push to another older repository and https://travis-ci.org builds fine. I double checked that the .travis.yml file is exactly like other repositories that do build. I checked github Authorizing OAuth Apps and travis is there.
.travis.yml
language: python
install:
- pip install sphinx sphinx_rtd_theme mock
script:
- sphinx-build -Wv docs/source docs/html
deploy:
# publish docs on push
- provider: pages
skip_cleanup: true
keep-history: false
github_token: $GH_TOKEN
local_dir: docs/html
on:
branch: master
I made a second repo just to make sure I did it correctly.
I follow my instructions for setting up a GitHub, sphinx and travis each time I create a repo.

No GitHub Actions workflows detected in repository

I am trying to build and push a docker image to Amazon ECR with GitHub Actions by following this tutorial
I'm trying to set up GitHub Actions for this repo, so I've created a new workflow in the .github/workflows directory.
The DockerFile is successfully created and build.
Now, after creating build.yml and committing it into the master branch ,when I go to the "Actions" tab in the repository no workflows are shown.
I'm thinking that probably there is an issue in the .yml file but no error is visible.
Does anyone have an idea what's wrong?
push:
paths:
- app/**
How about removing this line? I see you don't have app/ directory. See more in detail: https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#excluding-paths

Github action does not trigger when I push code from a local to a remote branch

I created a Github action that prints out some strings with the statement. The action triggers when I make commits on github.com, but does not trigger when I make commits locally and push them to the remote repository at github.com. Why is this?
Here is my action...
name: FeatureCI
on:
push:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v1
- name: Run a one-line script
run: echo "Only on featuer branches"
- name: Run a multi-line script
run: |
echo "Only on featuer branches1"
echo "Only on featuer branches2"
Try simplifying your 'on' trigger. Since you don't care which branch you are pushing to, it can be stated as so:
on: [push]
Not a solution, but in my case it was just a delay on GitHub side.
After poking around with my workflow .yml file I found nothing wrong, and then GH suddenly started to run my pipelines.
I ran into a similar issue. In addition to Lando1n's suggestion, I would recommend making sure that your action file is on the desired feature branch. When you push from feature-branch, Github will only execute actions that are specified in the action file on feature-branch. See my similar answer here.
In my case my .github/ folder was not in the root folder. I just moved to the root path and it worked.
My issue was that when I test pipelines etc. I push Empty Commits, something like this:
git commit --allow-empty -m "Empty Commit"
That didn't trigger it, but when I made an actual change it would trigger.

Deploy user Github pages only after Travis tests passed

I'm trying to deploy an User github page only after the execution of all the Travis tests.
However, User pages must be built from the master branch and I need it to be built from the gh-pages if I want Travis to deploy once the tests passed.
The .travis.yml is:
language: node_js
node_js:
- "8.1"
sudo: false
before_install:
- rvm install 2.2.2
- ./tool/before_install.sh
script: ./tool/travis.sh
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN # Set in travis-ci.org dashboard, marked secure
keep-history: true
on:
branch: master
This configuration file works fine when the gh-pages branch is the one the github page is built from, but when I switch my github page to an User page, I can't choose the gh-pages branch anymore, as shown here:
I tried to change the .travis.yml file:
language: node_js
node_js:
- "8.1"
sudo: false
before_install:
- rvm install 2.2.2
- ./tool/before_install.sh
script: ./tool/travis.sh
branches:
only:
- gh-pages
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN # Set in travis-ci.org dashboard, marked secure
keep-history: true
on:
branch: gh-pages
And then to git push on the gh-pages branch instead of the master hoping it will deploy then on the master one such as when I did git push to the master one and it deployed on the gh-pages, but it does not update the master one in this case and so, the modifications are not considered.
And also, when I tried not to use the gh-pages step, the changes were deployed by Github/pages before the end of the Travis tests, so the Github page was updated even if the tests failed.
Is there a way I did not think about to make this works?