-
Notifications
You must be signed in to change notification settings - Fork 16
102 lines (85 loc) · 2.49 KB
/
release.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
name: Build, Release, and Deploy
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm i
- name: Build
run: pnpm build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Prepare docs for Pages
run: |
touch dist/docs/.nojekyll
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: dist/docs
- name: Get current version
id: get_version
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
- name: Bump version
id: bump_version
run: |
npm version patch -m "Bump version to %s"
echo "::set-output name=new_version::$(node -p "require('./package.json').version")"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.bump_version.outputs.new_version }}
release_name: Release ${{ steps.bump_version.outputs.new_version }}
draft: false
prerelease: false
- name: 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: ./dist/epub/*.epub
asset_name: ebook.epub
asset_content_type: application/epub+zip
- name: Push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git push --follow-tags
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build-and-release
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2