mithi / hexapod

Blazing fast hexapod robot simulator for the web.
https://hexapod.netlify.app
Apache License 2.0
578 stars 70 forks source link

Deployment and github actions #56

Closed mithi closed 4 years ago

mithi commented 4 years ago

Deploy and setup continuous integration

mithi commented 4 years ago

I found out about this:

So you want to host your Single Page React App on GitHub Pages?

GitHub has this feature called GitHub Pages that converts a GitHub repository into a living, breathing website with a click of the button… as long as this repo is a) written in Frontend code only(Javascript, CSS and HTML) and apparently b) not written in React. If you’ve recently finished a React single page application like me that employs a heavy use of React’s Router Dom library to render certain components when users navigate to certain URLs then this guide is for you.

React-router problem with gh-pages

https://medium.com/@Dragonza/react-router-problem-with-gh-pages-c93a5e243819

Gh-pages deployment problems with react-router

GitHub Pages doesn't natively support single page apps

GitHub Pages doesn't natively support single page apps. When there is a fresh page load for a url like example.tld/foo, where /foo is a frontend route, the GitHub Pages server returns 404 because it knows nothing of /foo. https://github.com/rafrex/spa-github-pages

References

mithi commented 4 years ago

Options on where to deploy

References

mithi commented 4 years ago

Github actions examples

Install node dependencies

mithi commented 4 years ago

Prettier

name: Format (prettier)

on:
    pull_request:
        paths:
            - '**.css'
            - '**.js'
            - '**.vue'

jobs:
    prettier:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v1

            - name: Install
              run: yarn install
              env:
                  CI: true

            - name: Run prettier
              run: yarn run prettier --write 'src/**/*.{css,js,vue}'

            - uses: stefanzweifel/git-auto-commit-action@v2.1.0
              with:
                  commit_message: Apply prettier changes
                  branch: ${{ github.head_ref }}
              env:
                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

https://stefanzweifel.io/posts/run-prettier-or-php-cs-fixer-with-github-actions/

mithi commented 4 years ago

https://github.com/mithi/hexapod/commit/fc765d81a6b65ca19dccea8196f88471f9580715