Hi there,
The situation:
I have a simple gatsby-project with some headless CMS features.
Now I pushed my local directory to my github repo in a branch called ‘dev’ (contains config.yml /src package.json etc.)
Goal:
I want to use circleCI to build the code and than push the builded code (static files) to the main branch in a folder called “public” so it can be deployed to my clients “self-hosted” hoster using cPanel"
Problem:
I get the code to build but i have no clue where this build lives now.
Question
So, how can i instruct circleCI to:
build into a “public” folder and then push “public” from dev branch to main branch
A lot of thanks in advance,
Here is my attempt:
version: 2.1
jobs:
build:
executor: node/default
steps:
- checkout
- node/install-packages:
cache-path: ~/project/node_modules
override-ci-command: npm install
- run: npm run build
push:
machine: true
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "<my_fingerprint>"
- run:
name: Commit to GitHub
command: |
git config user.email "<my_email>"
git config user.name "<my_username>"
git commit --allow-empty -am "Automatic commit from CircleCI [skip ci]"
git push origin main
orbs:
node: circleci/node@4.0.0
workflows:
build-and-deploy:
jobs:
- build
- push