-
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (85 loc) · 2.62 KB
/
docs.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
name: Lint Docs
on:
push:
paths: ['**/*.md', '**/docs.yml']
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REPO_NAME: ${{ github.event.repository.name }}
MOD_PATH: ~/.vmodules/vibe/
jobs:
debounce:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
outputs:
abort: ${{ steps.debounce.outputs.abort }}
steps:
- name: Debounce
if: github.ref_name != 'main' && github.event_name == 'push'
id: debounce
run: |
pr_branches=$(gh pr list --json headRefName --repo $GITHUB_REPOSITORY)
if [[ $(echo "$pr_branches" | jq -r --arg GITHUB_REF '.[].headRefName | select(. == $GITHUB_REF)') ]]; then
echo "This push is associated with a pull request. Skipping the job."
echo "abort=true" >> "$GITHUB_OUTPUT"
fi
check-docs:
runs-on: ubuntu-latest
needs: debounce
if: needs.debounce.outputs.abort != 'true'
steps:
- name: Restore Cache
id: cache-status
uses: actions/cache/restore@v3
with:
path: |
vlang
~/.vmodules
key: ubuntu-latest${{ github.sha }}
- name: Setup V
uses: vlang/[email protected]
- name: Setup Dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libcurl4-openssl-dev
version: 1.0
- name: Checkout ${{ env.REPO_NAME }}
if: ${{ steps.cache-status.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
path: ${{ env.REPO_NAME }}
- name: Copy ${{ env.REPO_NAME }} to .vmodules
if: ${{ steps.cache-status.outputs.cache-hit != 'true' }}
run: cp -r ${{ env.REPO_NAME }} ${{ env.MOD_PATH }}
- name: Check Markdown
run: v check-md -hide-warnings ${{ env.MOD_PATH }}
deploy:
concurrency:
group: pages
cancel-in-progress: false
runs-on: ubuntu-latest
if: github.ref_name == 'main' && github.event_name == 'push'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install V
uses: vlang/[email protected]
with:
check-latest: true
- name: Checkout
uses: actions/checkout@v3
- name: Build docs
run: docs/build.vsh
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'docs/site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2