-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (93 loc) · 2.97 KB
/
deploy.yml
File metadata and controls
99 lines (93 loc) · 2.97 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
name: Build and publish docs to GitHub Pages
on:
# Runs on tags only
push:
tags:
- '**'
# 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: write
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Restore cache
uses: actions/cache@v3
with:
path: |
dist
key: ${{ runner.os }}-build-${{ hashFiles('dist') }}
restore-keys: |
${{ runner.os }}-build-
- name: Install dependencies
run: npm ci
- name: Static HTML export with VitePress - /docs (for coderbot)
run: |
mv ./docs/.vitepress/config.ts ./docs/.vitepress/config_root.ts
mv ./docs/.vitepress/config_docs.ts ./docs/.vitepress/config.ts
npm run docs:build
tar czf ./docs.tgz -C ./docs/.vitepress/dist .
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
draft: ${{ contains( github.ref_name, 'main') }}
prerelease: false
- name: Static HTML export with VitePress - / (for website)
run: |
mv ./docs/.vitepress/config.ts ./docs/.vitepress/config_docs.ts
mv ./docs/.vitepress/config_root.ts ./docs/.vitepress/config.ts
npm run docs:build
- name: Upload built docs to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}"
asset_path: docs.tgz
asset_name: docs.tgz
asset_content_type: application/gzip
- name: Set publish_info
id: publish_info
run: |
echo "::set-output name=release_id::${{ steps.create_release.outputs.id }}"
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.publish_info.outputs.release_id }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
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@v1