forked from jeffreytse/jekyll-theme-yat
-
Notifications
You must be signed in to change notification settings - Fork 5
96 lines (82 loc) · 2.42 KB
/
pr-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
name: Test build and deploy
on:
pull_request:
branches:
- master
paths-ignore:
- ".github/workflows/pages-build.yml"
- ".github/workflows/pr-clean.yml"
- ".gitignore"
- "CNAME"
- "LICENSE.txt"
- "README.md"
types:
- opened
- reopened
- synchronize
- ready_for_review
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
get-basepath:
if: ${{ !github.event.pull_request.draft }}
uses: ./.github/workflows/_get_basepath.yml
build:
runs-on: ubuntu-latest
needs: [get-basepath]
env:
base_path: ${{ needs.get-basepath.outputs.base_path }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Patch link
run: |
sed -i "s#https://seoklab.org#https://cluster.seoklab.org:8443#g" _config.yml
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- run: bundle exec jekyll build -b "$base_path"
env:
JEKYLL_ENV: production
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
runs-on: [self-hosted, galaxy3]
needs: [get-basepath, build]
env:
base_path: ${{ needs.get-basepath.outputs.base_path }}
steps:
- name: Make directory
run: mkdir -p ~/www/html/"$base_path"
- uses: actions/download-artifact@v4
id: download
with:
name: github-pages
- name: Extract artifact
run: tar -C ~/www/html/"$base_path" -xvf ${{ steps.download.outputs.download-path }}/artifact.tar
comment:
needs: [get-basepath]
runs-on: ubuntu-latest
if: ${{ github.event.action == 'opened' }}
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Thanks for your contribution! Your changes will be reflected in <https://cluster.seoklab.org:8443/${{ needs.get-basepath.outputs.base_path }}>. Please check the link and merge this PR if everything is fine.'
});