-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c71a9a2
commit dbc81f5
Showing
1 changed file
with
64 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Build and push | ||
on: | ||
push: | ||
branches: [master] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: pnpm | ||
- name: Install dependencies | ||
run: pnpm i | ||
|
||
- name: Build | ||
run: pnpm run build | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist/* | ||
|
||
push: | ||
name: Push to branch | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: builds | ||
|
||
- name: Cleanup | ||
run: git rm -r . || git rm -r * || true | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: dist | ||
path: "." | ||
|
||
- name: Commit files | ||
run: | | ||
git config --local user.email "actions@github.com" | ||
git config --local user.name "GitHub Actions" | ||
git add . | ||
git commit -m "Build $GITHUB_SHA" || exit 0 | ||
git push |