Skip to content

Commit 87a8393

Browse files
committed
auto articact branch
1 parent 36a4437 commit 87a8393

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/push.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build and Store Artifact
22

3+
permissions:
4+
contents: write
5+
36
on: [push]
47

58
jobs:
@@ -22,3 +25,23 @@ jobs:
2225
with:
2326
name: package
2427
path: dist
28+
29+
30+
- name: Push artifact to artifacts branch
31+
run: |
32+
# Configure Git
33+
git config user.name "github-actions[bot]"
34+
git config user.email "github-actions[bot]@users.noreply.github.com"
35+
36+
# Create or switch to artifacts branch
37+
git fetch origin artifacts || true
38+
git checkout -B artifacts origin/artifacts || git checkout -b artifacts
39+
40+
# Copy build output (adjust folder name if needed)
41+
rm -rf *
42+
cp -r ../$(basename $GITHUB_WORKSPACE)/dist/* .
43+
44+
# Commit and push
45+
git add .
46+
git commit -m "Artifact from PR #${{ github.event.pull_request.number }}"
47+
git push origin artifacts --force

0 commit comments

Comments
 (0)