Update Home.tsx #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create PR with Build | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
build-and-create-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: | | |
npm run build | |
# Save the build in a temporary folder | |
mv build /tmp/build | |
- name: Create PR branch | |
run: | | |
git config --global user.name "github-actions-bot" | |
git config --global user.email "support+actions@github.com" | |
# Delete all files except .git | |
find . -maxdepth 1 ! -name '.git' ! -name '.' -exec rm -rf {} + | |
# Create a new branch | |
timestamp=$(date +%s) | |
branch_name="build-update-${timestamp}" | |
git checkout -b $branch_name | |
# Copy files from build folder | |
cp -r /tmp/build/* . | |
# Commit and push the new build files to the new created branch | |
git add . | |
git commit -m "Updates" | |
git push origin $branch_name | |
- name: Create Pull Request | |
uses: repo-sync/pull-request@v2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
destination_branch: "gh-pages" | |
source_branch: ${{ format('build-update-{0}', steps.get-timestamp.outputs.timestamp) }} | |
pr_title: "Update build files" | |
pr_body: "Automated PR to update build files" | |
pr_label: "automated pr" |