-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from chkfung/ncc-automate-2
Ncc automate to manual trigger
- Loading branch information
Showing
1 changed file
with
15 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
name: Build with ncc | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
|
@@ -18,10 +16,21 @@ jobs: | |
- name: Build with ncc | ||
run: npx @vercel/ncc build index.js -o dist | ||
|
||
- name: Commit and push if changed | ||
- name: Create new branch and commit changes | ||
id: create_branch | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Action" | ||
BRANCH_NAME=automated-build-$(date +'%Y%m%d%H%M%S') | ||
git checkout -b $BRANCH_NAME | ||
git add dist/index.js | ||
git diff --quiet && git diff --staged --quiet || git commit -m "Automated build" | ||
git push | ||
git commit -m "Automated build" | ||
git push origin $BRANCH_NAME | ||
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
title: Automated build | ||
body: This is an automated build. | ||
branch: ${{ env.BRANCH_NAME }} |