-
Notifications
You must be signed in to change notification settings - Fork 82
122 lines (104 loc) · 3.21 KB
/
build.yml
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
name: Build & Deploy
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
add-contributors:
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: BobAnkh/add-contributors@master
with:
REPO_NAME: 'saltyorg/docs'
CONTRIBUTOR: '### Contributors'
COLUMN_PER_ROW: '6'
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMG_WIDTH: '100'
FONT_SIZE: '14'
PATH: '/README.md'
COMMIT_MESSAGE: 'docs(README): update contributors'
AVATAR_SHAPE: 'square'
build:
runs-on: ubuntu-22.04
if: github.event.repository.fork == false && github.event_name != 'pull_request'
outputs:
url: ${{ steps.cloudflare.outputs.deployment-url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python 3
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- name: Restore cache
id: cache-docs-restore
uses: actions/cache/restore@v4
with:
key: docs-
path: .cache
restore-keys: |
docs-
- name: Install dependencies
run: sudo apt-get install pngquant
- name: Install wheel
run: pip install wheel
- name: Install mkdocs material insiders
run: |
pip install git+https://${{ secrets.GH_TOKEN }}@github.com/chazlarson/automaticSpoon.git
pip install mkdocs-material[recommended,git,imaging]
- name: Install requirements.txt
run: pip install -r requirements.txt
- name: Build mkdocs
run: |
mkdocs build --clean
mkdocs --version
env:
CI: true
- name: Publish to Cloudflare Pages
if: github.event.repository.fork == false
id: cloudflare
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: >
pages deploy site
--project-name=docs
--branch=main
--commit-hash=${{ github.sha }}
- name: Save build cache
id: cache-docs-save
uses: actions/cache/save@v4
with:
path: .cache
key: docs-${{ github.run_id }}
webhook:
name: 'webhook'
runs-on: ubuntu-latest
needs: build
if: always() && github.event_name != 'pull_request' && github.event.repository.fork == false
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Determine Workflow Conclusion
run: ./scripts/workflow-status.sh ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }}
- name: Send Discord Notification
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: "URL: ${{ needs.build.outputs.url }}"
status: ${{ env.WORKFLOW_CONCLUSION }}