Reputation: 3704
I have branch production
in my repo what triggering build
Action (to build all my TypeScript code).
Build script saves /dist (/build) folders as artifact, but I also want to create/update new branch named production-build
where I put all built code to be able to pull it later into production server.
Sure I can just put all my built code directly onto production server with Action script, but then I lost partial pulls and I am forced to "delete and unpack new" on all production files.
Upvotes: 1
Views: 877
Reputation: 106
Here is a simple example of a YAML workflow to set a custom branch as a deployment target.
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out # default: public
publish_branch: production-build # default: gh-pages
force_orphan: true
By enabling the force_orphan
, it keeps the latest commit only.
For more options and usages, see the latest README on our repo: peaceiris/actions-gh-pages: GitHub Actions for GitHub Pages
Upvotes: 1
Reputation: 1146
https://github.com/marketplace/actions/github-pages-action#%EF%B8%8F-force-orphan
You can use the page above as a reference for github action to make an orphan branch when the build is completed.
Force orphan We can set the force_orphan: true option. This allows you to make your publish branch with only the latest commit.
- name: Deploy uses: peaceiris/actions-gh-pages@v3 with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
force_orphan: true
Upvotes: 2