-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (65 loc) · 2.28 KB
/
main.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
name: Build and Deploy Docs
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- '.github/**'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/[email protected]
- name: Get Latest Commit
id: get_latest_commit
run: echo "::set-output name=COMMIT_HASH::$(git rev-parse HEAD)"
shell: bash
- name: Shorten Commit Hash
id: shorten_commit_hash
run: echo "::set-output name=SHORT_COMMIT_HASH::${COMMIT_HASH::7}"
env:
COMMIT_HASH: ${{ steps.get_latest_commit.outputs.COMMIT_HASH }}
shell: bash
- name: Setup Node.js environment
uses: actions/[email protected]
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Dependencies
run: pnpm install
- name: Build
run: pnpm build
env:
GIT_COMMIT_HASH: ${{ steps.shorten_commit_hash.outputs.SHORT_COMMIT_HASH }}
- name: Deploy
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.FTP_HOST }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
local-dir: "./.vitepress/dist/"
- name: Compress Build Artifacts
run: zip -r docs.zip ./.vitepress/dist/*
working-directory: ${{ github.workspace }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.shorten_commit_hash.outputs.SHORT_COMMIT_HASH }}
release_name: Release ${{ steps.shorten_commit_hash.outputs.SHORT_COMMIT_HASH }}
body: Build-${{ steps.shorten_commit_hash.outputs.SHORT_COMMIT_HASH }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./docs.zip
asset_name: docs-${{ steps.shorten_commit_hash.outputs.SHORT_COMMIT_HASH }}.zip
asset_content_type: application/zip