-
Notifications
You must be signed in to change notification settings - Fork 274
80 lines (70 loc) · 2.96 KB
/
update-website.yaml
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
name: Update Website
on:
workflow_dispatch: {}
release:
types: [released]
jobs:
update-website:
if: github.repository_owner == 'Apicurio'
runs-on: ubuntu-20.04
steps:
- name: Check Prerequisites
if: github.event_name != 'workflow_dispatch' && !startsWith(github.event.release.tag_name, '2.6.')
run: |
exit 1
- name: Apicurio Website Checkout
run: |
mkdir website
cd website
git init
git config --global user.name "apicurio-ci"
git config --global user.email "apicurio.ci@gmail.com"
git remote add origin "https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apicurio/apicurio.github.io.git"
git fetch
git checkout main
git branch --set-upstream-to=origin/main
git pull
- name: Apicurio Playbook Checkout
run: |
mkdir docs-playbook
cd docs-playbook
git init
git config --global user.name "apicurio-ci"
git config --global user.email "apicurio.ci@gmail.com"
git remote add origin "https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apicurio/apicurio-docs-playbook.git"
git fetch
git checkout main
git branch --set-upstream-to=origin/main
git pull
- name: Generate Project Documentation for Website
run: |
echo "********** Building Registry Documentation using Antora **********"
cd docs-playbook
docker pull apicurio/apicurio-docs-builder:latest
docker run -v $(pwd):/apicurio-docs-playbook apicurio/apicurio-docs-builder:latest
rm -rf ../website/registry/docs/*
cp -rf target/dist/* ../website/registry/docs/.
- name: Fetch required Details
run: echo "RELEASE_VERSION=$(curl https://api.github.com/repos/apicurio/apicurio-registry/releases/latest | jq '.name' | sed 's/"//g')" >> $GITHUB_ENV
- name: Updating Project Website for Release ${{ env.RELEASE_VERSION }}
run: |
cd website
echo "********** Replacing Existing Latest Release JSON File **********"
cd _data/registry
rm latestRelease.json
touch latestRelease.json && curl https://api.github.com/repos/apicurio/apicurio-registry/releases/latest > latestRelease.json
echo "********** Saving a copy in the archieve **********"
cp latestRelease.json releases/${RELEASE_VERSION}.json
- name: Commit Project Website Changes
run: |
cd website
git add .
git commit -m "Automated Update For Apicurio Registry Release Version: ${{ env.RELEASE_VERSION }}"
git push
- name: Google Chat Notification
if: ${{ failure() }}
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}