Reputation: 1237
I have a dev
branch where I have Gatsby personal website. I also have a main
branch accordingly which is used to publish my personal website.
I want to map GitHub pages to my custom domain. For this, I need a new file named CNAME
in main
with some content.
I found the following GitHub action in order to achieve file creation in the same branch.
https://github.com/marketplace/actions/create-file
I am looking for a similar GitHub action that can create a new file in a new branch.
Here's my current version of GitHub pages:
name: Publish saint1729 Personal Site
on:
push:
branches: [ dev ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: enriikke/[email protected]
with:
access-token: ${{ secrets.portfolio }}
deploy-branch: main
gatsby-args: --prefix-paths
Upvotes: 0
Views: 10477
Reputation: 1796
To answer your question of an action that would allow you to push a specific file to a specific branch, this might help:
https://github.com/marketplace/actions/add-commit
I chose this because it's evolved (v7) and has had many contributors.
Upvotes: 2
Reputation: 667
Because of uses: actions/checkout@v2
you have a checkout of your code. You can create a branch by calling git branch the-of-the-branch
. And with git push
you can push it to the origin repository.
Upvotes: 2