-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (110 loc) · 3.57 KB
/
deploy-gh-pages.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
103
104
105
106
107
108
109
110
111
112
113
name: Generate & deploy docs to GitHub Pages
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
outputs:
last-tag: ${{ steps.last-tag.outputs.tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
# Setting up pages and generating the docs
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: 'Get Previous tag'
id: last-tag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: Generate API documentation
run: |
./gradlew -PdocVersion=${{ steps.last-tag.outputs.tag }} dokkaHtml
# Uploading the generated files as build artifacts
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./build/dokka/html
deploy:
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write
id-token: write # to verify the deployment originates from an appropriate source
outputs:
docs-url: ${{ steps.deployment.outputs.page_url }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
notify:
needs: [ build, deploy ]
runs-on: ubuntu-latest
steps:
- name: Notify Slack
id: slack
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hello Lovelies,\n Version `${{needs.build.outputs.last-tag}}` of *<${{github.server_url}}/${{github.repository}}|${{github.repository}}>* was released just now!"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":page_facing_up: Read the docs",
"emoji": true
},
"url": "${{needs.deploy.outputs.docs-url}}"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":clipboard: Changelog",
"emoji": true
},
"url": "${{github.server_url}}/${{github.repository}}/blob/master/CHANGES.md"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":package: Commits",
"emoji": true
},
"url": "${{github.server_url}}/${{github.repository}}/commits/${{needs.build.outputs.last-tag}}"
}
]
}
]
}