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.
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
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: peaceiris/actions-gh-pages: GitHub Actions for GitHub Pages Deploy static files and publish your site easily. Static-Site-Generators-friendly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.