-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (99 loc) · 2.98 KB
/
pull_request.yaml
File metadata and controls
104 lines (99 loc) · 2.98 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
100
101
102
103
104
name: Pull Request Builder
on:
pull_request:
types:
- opened
- reopened
- synchronize
- edited
- auto_merge_enabled
- auto_merge_disabled
- closed
branches:
- 'main'
permissions:
actions: write
contents: write
id-token: write
pull-requests: write
concurrency:
group: "documentation"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build-test:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: "Prepare Documentation Builder"
run: |
./doc-builder build-image
- name: "Build Documentation Test"
run: |
./doc-builder update-repositories
./doc-builder build
build-deploy-pr:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
needs: build-test
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: "Prepare Documentation Builder"
run: |
./doc-builder build-image
- name: "Build Documentation"
run: |
./doc-builder update-repositories
./doc-builder build
- name: "Creating Deployment Artifact"
run: |
mv site "${{ github.head_ref }}"
ls -lah
zip -r "${{ github.head_ref }}.zip" . -i "${{ github.head_ref }}/*"
- name: "Uploading Pull Request Deployment"
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.ssh_server }}
port: ${{ secrets.ssh_port }}
username: ${{ secrets.ssh_username }}
key: ${{ secrets.ssh_key }}
source: "${{ github.head_ref }}.zip"
target: .
- name: "Deploying Pull Request Deployment"
uses: appleboy/ssh-action@v1.2.1
with:
host: ${{ secrets.ssh_server }}
port: ${{ secrets.ssh_port }}
username: ${{ secrets.ssh_username }}
key: ${{ secrets.ssh_key }}
script: |
./pull_request_helper.sh deploy ${{ github.head_ref }}
- name: Add Pull Request Deployment Comment"
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🤖: Deployment available as https://docstest.simplyblock.io/${{ github.head_ref }}'
})
remove-closed-pr:
if: github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- name: "Removing Pull Request Deployment"
uses: appleboy/ssh-action@v1.2.1
with:
host: ${{ secrets.ssh_server }}
port: ${{ secrets.ssh_port }}
username: ${{ secrets.ssh_username }}
key: ${{ secrets.ssh_key }}
script: |
./pull_request_helper.sh remove ${{ github.head_ref }}