-
-
Notifications
You must be signed in to change notification settings - Fork 16
148 lines (125 loc) · 3.75 KB
/
deploy-gh-pages.yaml
File metadata and controls
148 lines (125 loc) · 3.75 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Sample workflow for building and deploying a documentation site to GitHub Pages
name: Deploy GitHub Pages
on:
# Runs on pushes targeting the default branch
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: pages
cancel-in-progress: true
jobs:
# Generate OpenAPI docs
generate-openapi:
name: Generate OpenAPI docs
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.4
env:
MYSQL_DATABASE: micro_power_manager
MYSQL_ROOT_PASSWORD: wF9zLp2qRxaS2e
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
redis:
image: redis:5
ports:
- 6379:6379
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug
- name: Get version
run: |
VERSION=$(cat version)
echo "SCRAMBLE_OPEN_API_VERSION=$VERSION" >> $GITHUB_ENV
- name: Install Composer Dependencies
working-directory: ./src/backend
run: |
composer install --no-interaction --prefer-dist
composer dump-autoload
- name: Wait for MySQL to be ready
run: |
while ! mysqladmin ping -h"127.0.0.1" -P3306 -u root -pwF9zLp2qRxaS2e --silent; do
sleep 1
done
- name: Prepare the database for OpenAPI generation
working-directory: ./src/backend
env:
DB_HOST: 127.0.0.1
DB_DATABASE: micro_power_manager
DB_USERNAME: root
DB_PASSWORD: wF9zLp2qRxaS2e
run: |
php artisan migrate --seed
- name: Export OpenAPI from Scramble with Laravel Export
working-directory: ./src/backend
env:
APP_KEY: base64:qq4VUCgym1gBAIH4GFWHeNNZFBiSpNM2IyLibtf6R1U=
JWT_SECRET: TihQ232bmMermM8HKaLHwzRl5JSuxwqhfEAQKxRHrQqjRUwrsw1FRZhAcLkihEDU
DB_HOST: 127.0.0.1
DB_DATABASE: micro_power_manager
DB_USERNAME: root
DB_PASSWORD: wF9zLp2qRxaS2e
SCRAMBLE_OPEN_API_PROD_SERVERS: true
run: php artisan export
- name: Upload OpenAPI artifact
uses: actions/upload-artifact@v4
with:
name: openapi-docs
path: src/backend/dist/docs/api
# Build job
build:
runs-on: ubuntu-latest
needs: generate-openapi
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download OpenAPI artifact
uses: actions/download-artifact@v4
with:
name: openapi-docs
path: docs/.public/openapi
- name: Setup Pages
uses: actions/configure-pages@v2
- uses: actions/setup-node@v4
with:
node-version: lts/iron
- name: Install tooling
working-directory: docs
run: npm install
- name: Build docs with VitePress
working-directory: docs
run: npm run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist/
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4