Is there a way to setup Github Actions to run multiple npm run build
s? I wanted to use multiple repos and set them as different webpages on the main site.
Imagine I had 3 repos: Main, Angular App, and React App.
The Main repo would have my landing site. Angular App and React App would be two different sites.
From foobar.github.io
(main repo), I would go to foobar.github.io/angular
to navigate to my Angular App. foobar.github.io/react
would be a react app.
Each application would be in 3 different repositories. Is there a way for me to push to my Angular App and GitHub Actions would automatically do an ng build --prod --base-href='angular'
, and update that page or even run a build for all repositories and deploy it?
To do this locally, I would have to do a build command on each repository, and then drag each prod
folder into my repo, then push it up, which, in my opinion, can get very inefficient.
GitHub Pages Deploy Action This GitHub Action will automatically deploy your project to GitHub Pages. It can be configured to push your production-ready code into any branch you'd like, including gh-pages and docs. It can also handle cross repository deployments and works with GitHub Enterprise too.
GitHub Actions. Automate, customize, and execute your software development workflows right in your repository with GitHub Actions. You can discover, create, and share actions to perform any job you'd like, including CI/CD, and combine actions in a completely customized workflow. Quickstart Reference.
Any secrets must be referenced using the bracket syntax and stored in the GitHub repository's Settings/Secrets menu. You can learn more about setting environment variables with GitHub actions here. The following options must be configured in order to make a deployment. The folder in your repository that you want to deploy.
No you are not limited, it is possible to have multiple GitHub Pages sites within one account. Create another GitHub repository and push your site files to the gh-pages branch. Now, push another file "CNAME" to the same repository and branch and fill it with movies.tshepang.net.
The easiest way to do this would be to add a workflow to each repository that updates the corresponding area in Pages. I.e. in the "Main" repo, it would look something like:
on: push
jobs:
main:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: TODO
- name: Publish
run: TODO
And in the other repositories, you'd have something similar. For example in the Angular repository:
on: push
jobs:
angular:
steps:
- name: Checkout App
uses: actions/checkout@v2
- name: Build Angular
run: |
npm ci
npm run build
ng build --prod --base-href='angular'
- name: Publish
run: TODO
If you wanted to only publish when you update Main, you could have a workflow in your Main repository that builds and publishes all three, e.g.:
on: push
jobs:
main:
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
repository: my-org/main
path: main
- name: Build
run: TODO
working-directory: ./main
- name: Publish
run: TODO
working-directory: ./main
react:
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
repository: my-org/react
path: react
- name: Build React
run: TODO
working-directory: ./react
- name: Publish
run: TODO
working-directory: ./react
angular:
steps:
- name: Checkout App
uses: actions/checkout@v2
with:
repository: my-org/angular
path: angular
- name: Build Angular
run: |
npm ci
npm run build
ng build --prod --base-href='angular',
working-directory: ./angular
- name: Publish
run: TODO
working-directory: ./angular
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With