3
3
name : Deploy Docs and ESPHome Firmware to Pages
4
4
5
5
on :
6
- # Allows you to run this workflow manually from the Actions tab
7
6
workflow_dispatch :
8
-
9
- # Runs on pushes targeting the `main` branch. Change this to `master` if you're
10
- # using the `master` branch as the default branch.
11
7
push :
12
- branches : [master]
13
8
14
9
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15
10
permissions :
@@ -24,44 +19,9 @@ concurrency:
24
19
cancel-in-progress : false
25
20
26
21
jobs :
27
- # Build job
28
22
build-docs :
29
- runs-on : ubuntu-latest
30
- steps :
31
- - name : Checkout
32
- uses : actions/checkout@v4
33
- with :
34
- fetch-depth : 0
35
-
36
- - name : Setup Node
37
- uses : actions/setup-node@v4
38
- with :
39
- node-version : 20
40
- cache : npm
41
-
42
- - name : Setup Pages
43
- uses : actions/configure-pages@v4
44
-
45
- - name : Extract version from base.yaml
46
- run : |
47
- VERSION=$(awk '/project:/, /version:/' firmware/base.yaml | grep 'version:' | awk '{print $2}' | sed 's/[",]//g')
48
- echo "VERSION=${VERSION}" >> $GITHUB_ENV
49
-
50
- - name : Update package.json version
51
- run : |
52
- sed -i "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/" package.json
53
-
54
- - name : Install dependencies
55
- run : npm ci
56
-
57
- - name : Build with VitePress
58
- run : npm run docs:build
59
-
60
- - name : Upload VitePress artifact
61
- uses : actions/upload-artifact@v4
62
- with :
63
- name : vitepress-docs
64
- path : docs/.vitepress/dist
23
+ name : Build Docs
24
+ uses : ./.github/workflows/build-docs.yml
65
25
66
26
build-doorman-stock-firmware :
67
27
name : Build Doorman Stock Firmware
@@ -115,19 +75,47 @@ jobs:
115
75
path : output/firmware/release
116
76
117
77
- name : Upload Pages artifact
78
+ if : github.ref == 'refs/heads/master'
118
79
uses : actions/upload-pages-artifact@v3
119
80
with :
120
81
path : output
82
+
83
+ - name : Upload Assets Bundle
84
+ if : github.ref != 'refs/heads/master'
85
+ uses : actions/upload-artifact@v4
86
+ with :
87
+ name : asset-bundle
88
+ path : output
121
89
122
90
# Deployment job
123
- deploy :
91
+ deploy-master :
92
+ if : github.ref == 'refs/heads/master'
93
+ name : Deploy to Github Pages
124
94
environment :
125
95
name : github-pages
126
96
url : ${{ steps.deployment.outputs.page_url }}
127
97
needs : [bundle-assets]
128
- runs-on : ubuntu-latest
129
- name : Deploy
98
+ runs-on : ubuntu-latest
130
99
steps :
131
100
- name : Deploy to GitHub Pages
132
101
id : deployment
133
- uses : actions/deploy-pages@v4
102
+ uses : actions/deploy-pages@v4
103
+
104
+ deploy-dev :
105
+ if : github.ref != 'refs/heads/master'
106
+ name : Deploy to surge.sh
107
+ needs : [bundle-assets]
108
+ runs-on : ubuntu-latest
109
+ steps :
110
+ - name : Download Assets
111
+ uses : actions/download-artifact@v4
112
+ with :
113
+ name : asset-bundle
114
+ path : output
115
+
116
+ - uses : actions/setup-node@v4
117
+ with :
118
+ node-version : 20
119
+
120
+ - run : npm install -g surge
121
+ - run : surge output ${{ secrets.SURGE_DOMAIN }} --token ${{ secrets.SURGE_TOKEN }}
0 commit comments