-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (95 loc) · 2.93 KB
/
.github_ci.yaml
File metadata and controls
116 lines (95 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Build and Deploy to GitHub Pages
on:
workflow_dispatch:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "24" # Use your project's Node version
- name: Install dependencies
run: npm install # Assumes you have a package.json with dependencies
- name: Compile TypeScript
run: npm run build # Assumes "build" script compiles TypeScript and builds the site
- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: build-output
path: ./dist # Adjust the path to your build output folder, e.g., "dist" or "build"
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "24" # Use your project's Node version
- name: Install dependencies
run: npm install # Assumes you have a package.json with dependencies
- name: Run ESLint
run: npm run lint # Assumes "lint" script runs ESLint with --fix option
deploy:
needs: build
if: github.ref == 'refs/heads/stable'
permissions:
contents: write
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Download build output
uses: actions/download-artifact@v4
with:
name: build-output
- name: Deploy to GitHub Pages
id: deployment
uses: peaceiris/actions-gh-pages@v4
with:
publish_dir: ./ # Adjust the path to the downloaded artifact folder
github_token: ${{ secrets.GITHUB_TOKEN }}
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
id-token: write
steps:
- name: Download build output
uses: actions/download-artifact@v4
with:
name: build-output
path: dist
- name: Zip build output
run: |
cd dist
zip -r ../build.zip .
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build.zip
asset_name: build.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}