-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (75 loc) · 2.33 KB
/
Copy pathpull_request_closed.yml
File metadata and controls
90 lines (75 loc) · 2.33 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
name: Pull Request Closed
on:
pull_request:
types:
- closed
jobs:
update_github_pages:
name: Update the GitHub Page
runs-on: macos-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# checkout repo so can access the bash script
- uses: actions/checkout@v4
# create the "mysite/" directory
- name: Create the mysite/ directory
run: mkdir mysite
# download and extract drafts.tgz
- name: Download and extract drafts
run: |
cd mysite
curl -O https://netmod-wg.github.io/yang-xml/drafts.tgz
tar -xzvf drafts.tgz
rm drafts.tgz
# if merged... (i.e., PR succeeded)
- name: If merged, move compiled artifacts to 'main'
if: github.event.pull_request.merged == true
run: |
rm -rf mysite/main
mv mysite/${{github.head_ref}} mysite/main
# if not merged... (i.e., PR failed)
- name: If not merged, just delete the branch dir
if: github.event.pull_request.merged == false
run: |
rm -rf mysite/${{github.head_ref}}
# create index.html
- name: Create mysite/index.html
run: |
chmod +x .github/workflows/gen_index_html.sh
.github/workflows/gen_index_html.sh
# recreate the drafts.tgz
- name: Recreate drafts.tgz
run: |
cd mysite
tar -czvf drafts.tgz */
# upload site to github.io
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./mysite"
# deploy site to github.io
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
increment_git_tag:
name: Increment Git Tag
runs-on: macos-latest
needs: update_github_pages
if: github.event.pull_request.merged == true
steps:
# checkout repo so can run `git tag`
- uses: actions/checkout@v4
- name: Push the tag
run: |
cd mysite
ls main/
ls -1 main/draft-yn-netmod-yang-xml-[0-9][0-9].xml
TAG=`ls -1 main/draft-yn-netmod-yang-xml-[0-9][0-9].xml | sed -e 's/\.xml$//'`
echo "TAG=$TAG"
git tag $TAG
git push --tags