-
Notifications
You must be signed in to change notification settings - Fork 9
101 lines (96 loc) · 3.83 KB
/
prod.docs.plus.yml
File metadata and controls
101 lines (96 loc) · 3.83 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
# This workflow name appears in GitHub Actions UI.
name: CI-Stage
# Workflow will be triggered when code is pushed or a pull request is created on 'main' branch.
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
# This job builds and runs Uptime Kuma.
build-uptime-kuma:
runs-on: prod.docs.plus
if: contains(github.event.head_commit.message, 'uptime-kuma')
steps:
- name: Check out code
uses: actions/checkout@v4
with:
# Only fetch the latest commit to minimize checkout time
fetch-depth: 1
# Preserve existing files
clean: false
- name: Deploy Uptime Kuma
run: |
# Run your build command here
make build_uptime_kuma
# The "setup" job is responsible for setting up the environment and preparing for the build processes.
setup:
runs-on: prod.docs.plus
if: contains(github.event.head_commit.message, 'build') &&!contains(github.event.head_commit.message, 'uptime-kuma')
strategy:
matrix:
# This matrix configuration will run the job on the specific version of Node.js.
node-version: ['lts/*']
steps:
# This step checks out your repository under $GITHUB_WORKSPACE so your job can access it.
- name: Check out code
uses: actions/checkout@v4
# This step sets up Node.js on the runner and installs the version specified in the matrix above.
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# This step installs project dependencies using Yarn.
# The --frozen-lockfile option ensures the exact package versions specified in yarn.lock are installed.
- name: Install dependencies
run: yarn install --frozen-lockfile
# This step copies the .env file from the root directory to the required directories for each package.
# Update these paths if your repository structure is different.
- name: Copy .env files
run: |
cp ../../../.env packages/webapp
cp ../../../.env packages/hocuspocus.server
- name: Build monorepo packages
run: yarn build
env:
# The environment variable DATABASE_URL is sourced from a secret in your repository.
DATABASE_URL: ${{secrets.STAGE_DATABASE_URL}}
# The "build-front" job builds the front-end, it depends on the "setup" job.
build-front:
# Specifies that this job depends on the 'setup' job.
needs: setup
runs-on: prod.docs.plus
# This job will only run if the commit message contains the word 'front'.
if: contains(github.event.head_commit.message, 'front')
steps:
# This step runs the build command for the front-end.
- name: Build Front-end
run: make build_front_production
# The "build-back" job builds the back-end, it also depends on the "setup" job.
build-back:
# Specifies that this job depends on the 'setup' job.
needs: setup
runs-on: prod.docs.plus
# This job will only run if the commit message contains the word 'back'.
if: contains(github.event.head_commit.message, 'back')
steps:
# This step runs the build command for the back-end.
- name: Build Back-end
run: make build_hocuspocus.server_prod
# -----------------------------------------------------------------------
# EXAMPLE USAGE:
# 1) To run setup + build-front:
# git commit -m "Add feature (build front)"
#
# 2) To run setup + build-back:
# git commit -m "Fix backend (build back)"
#
# 3) To run setup + build-uptime-kuma:
# git commit -m "build uptime-kuma"
#
# 4) To run multiple pipelines together:
# git commit -m "Update everything (build front back uptime-kuma)"
#
# Then push to the 'main' branch (or open a pull request):
# git push origin main
# -----------------------------------------------------------------------