Skip to content

Commit 08ac9c8

Browse files
committed
feat: ✨ gitHub Actions
1 parent 148a2fb commit 08ac9c8

File tree

3 files changed

+135
-0
lines changed

3 files changed

+135
-0
lines changed

.github/workflows/auto-merge.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Auto merge main into git-pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [closed]
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
sync:
15+
if: github.event.pull_request.merged == true || github.event_name == 'push'
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout main branch
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Configure Git
25+
run: |
26+
git config user.name "github-actions[bot]"
27+
git config user.email "github-actions[bot]@users.noreply.github.com"
28+
29+
- name: Add git-pages remote
30+
run: |
31+
git remote add git-pages https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
32+
33+
- name: Fetch git-pages branch
34+
run: git fetch origin git-pages:git-pages
35+
36+
- name: Checkout git-page branch
37+
run: git checkout git-pages
38+
39+
- name: Merge main into git-pages
40+
run: |
41+
git merge main --no-ff -m "feat: ✨ Auto-merge main into git-pages"
42+
43+
- name: Push changes to git-pages
44+
run: git push origin git-pages
45+
46+
- name: Repository Dispatch
47+
uses: peter-evans/repository-dispatch@v3
48+
with:
49+
event-type: git-pages-deploy

.github/workflows/git-pages.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Automatic deployment to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- git-pages
7+
repository_dispatch:
8+
types: [git-pages-deploy]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
ref: ${{ github.event_name == 'push' && github.ref || 'git-pages' }}
18+
fetch-depth: 0
19+
20+
- name: Setup pnpm
21+
uses: pnpm/action-setup@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '22'
27+
cache: pnpm
28+
29+
- name: Setup Pages
30+
uses: actions/configure-pages@v5
31+
32+
- name: Install dependencies
33+
run: pnpm install
34+
35+
- name: Build
36+
run: pnpm build
37+
38+
- name: Upload artifact
39+
uses: actions/upload-pages-artifact@v3
40+
with:
41+
path: ./dist
42+
43+
deploy:
44+
environment:
45+
name: github-pages
46+
url: ${{ steps.deployment.outputs.page_url }}
47+
permissions:
48+
contents: read
49+
pages: write
50+
id-token: write
51+
needs: build
52+
runs-on: ubuntu-latest
53+
name: Deploy
54+
steps:
55+
- name: Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# .github/workflows/release.yml
2+
3+
name: Release
4+
5+
permissions:
6+
contents: write
7+
8+
on:
9+
push:
10+
tags:
11+
- 'v*'
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set node
22+
uses: actions/setup-node@v4
23+
with:
24+
registry-url: https://registry.npmjs.org/
25+
node-version: lts/*
26+
27+
- run: npx changelogithub # or changelogithub@0.12 if ensure the stable result
28+
env:
29+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)