forked from ballerina-platform/ballerina-dev-website
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (39 loc) · 1.56 KB
/
prod_sync_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
# This is a basic workflow that is manually triggered
name: Publish gh-pages to prod
on:
workflow_dispatch:
jobs:
prod-sync:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.WEBSITE_TOKEN }}
steps:
- name: Clone production b.io
run: git clone https://ballerina-bot:[email protected]/ballerina-platform/ballerina-platform.github.io.git
- name: Sync production repo with pre-prod
run: |
cd ballerina-platform.github.io
git checkout -b deploy-website-$GITHUB_SHA origin/gh-pages
git config --global user.email "[email protected]"
git config --global user.name "ballerina-bot"
git remote add dev https://github.com/ballerina-platform/ballerina-dev-website.git
git pull dev gh-pages -X theirs --no-edit --no-rebase
rm -rf CNAME robots.txt
cp -r ./utils/CNAME CNAME
cp -r ./utils/robots.txt robots.txt
rm -rf ./utils/
- name: Push changes
run: |
cd ballerina-platform.github.io
git add .
git commit --allow-empty -m 'Deploy website'
git push origin deploy-website-$GITHUB_SHA
echo 'Successfully pushed to deploy-website-$GITHUB_SHA branch'
- name: Create pull request for new site
shell: bash
run: |
cd ballerina-platform.github.io
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
bin/hub pull-request -b gh-pages -m '[Automated] Deploy website'
env:
GITHUB_TOKEN: ${{ secrets.WEBSITE_TOKEN }}