forked from netbootxyz/netboot.xyz
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (65 loc) · 4.68 KB
/
build-dev.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
name: Build cips@nyist dev ver.
on:
push:
branches: [ "nyist-pxe-dev" ]
pull_request:
branches: [ "nyist-pxe-dev" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Send start notification to WeCom
uses: chf007/action-wechat-work@master
env:
WECHAT_WORK_BOT_WEBHOOK: ${{ secrets.WECHAT_WEBHOOK_URL }}
with:
#msgtype: text
#content: "NYIST-CIPS/netboot 🔱nyist-pxe-dev 测试构建已开始🚀"
msgtype: template_card
template_card: '{"card_type":"news_notice","source":{"icon_url":"https://github.githubassets.com/favicons/favicon-dark.png","desc":"GitHub Actions 自动通知","desc_color":0},"main_title":{"title":"${{GITHUB.REPOSITORY}} 🔱${{GITHUB.REF_NAME}}工作流已启动🚀","desc":" 当前事件:${{GITHUB.event_name}} "},"card_image":{"url":"https://gh-card.dev/repos/${{GITHUB.REPOSITORY}}.png","aspect_ratio":2.25},"image_text_area":{"type":1,"url":"https://github.com/${{GITHUB.REPOSITORY}}/commit/${{GITHUB.WORKFLOW_SHA}}","title":"${{GITHUB.ACTOR}}","desc":"${{GITHUB.WORKFLOW_SHA}}","image_url":"https://avatars.githubusercontent.com/u/${{GITHUB.ACTOR_ID}}"},"vertical_content_list":[{"title":"Actions已开始执行...","desc":"敬请关注后续提示"}],"horizontal_content_list":[{"keyname":"Actions发起人","value":"${{GITHUB.TRIGGERING_ACTOR}}"},{"keyname":"Actions ID","value":"${{GITHUB.RUN_ID}}","type":1,"url":"https://github.com/${{GITHUB.REPOSITORY}}/actions/runs/${{GITHUB.RUN_ID}}"},{"keyname":"构建成果","value":"请稍后"}],"jump_list":[{"type":1,"url":"https://github.com/${{GITHUB.REPOSITORY}}","title":"${{GITHUB.REPOSITORY}} 仓库页面"}],"card_action":{"type":1,"url":"https://github.com/${{GITHUB.REPOSITORY}}"}}'
- name: Build the Docker image
run: docker build -t localbuild -f Dockerfile .
- name: Build site
run: docker run --rm -v $(pwd):/buildout localbuild
- name: Copy pxe background image
run: cp pxe_bg.png buildout/
- name: Create buildout archive
run: |
cd buildout
zip -r buildout.zip .
- name: Upload buildout artifact
uses: actions/upload-artifact@v2
with:
name: buildout
path: buildout/buildout.zip
- name: Deploy to GitHub Pages
if: github.repository == 'NYIST-CIPS/netboot' && github.ref == 'refs/heads/nyist-pxe-dev'
run: |
CINFO="$(git log -1 --pretty="[%h] %an: %s")"
cd buildout
git init --quiet
: > .nojekyll
git remote add origin https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git
git fetch --depth=1 origin gh-pages
git reset --soft FETCH_HEAD
git add --all
git -c user.name=GitHub -c [email protected] commit \
-m "Auto deploy from GitHub Actions build ${GITHUB_RUN_NUMBER}" \
-m "$CINFO"
git push origin +HEAD:gh-pages
- name: Send end notification to WeCom
uses: chf007/action-wechat-work@master
env:
WECHAT_WORK_BOT_WEBHOOK: ${{ secrets.WECHAT_WEBHOOK_URL }}
with:
#msgtype: text
#content: "NYIST-CIPS/netboot 🔱nyist-pxe-dev 测试构建成功✨"
msgtype: template_card
template_card: '{"card_type":"news_notice","source":{"icon_url":"https://github.githubassets.com/favicons/favicon-dark.png","desc":"GitHub Actions 自动通知","desc_color":0},"main_title":{"title":"${{GITHUB.REPOSITORY}} 🔱${{GITHUB.REF_NAME}}工作流已结束✨","desc":" 当前事件:${{GITHUB.event_name}} "},"card_image":{"url":"https://gh-card.dev/repos/${{GITHUB.REPOSITORY}}.png","aspect_ratio":2.25},"image_text_area":{"type":1,"url":"https://github.com/${{GITHUB.REPOSITORY}}/commit/${{GITHUB.WORKFLOW_SHA}}","title":"${{GITHUB.ACTOR}}","desc":"${{GITHUB.WORKFLOW_SHA}}","image_url":"https://avatars.githubusercontent.com/u/${{GITHUB.ACTOR_ID}}"},"vertical_content_list":[{"title":"Actions已结束✔","desc":"即将上传构建成果"}],"horizontal_content_list":[{"keyname":"Actions发起人","value":"${{GITHUB.TRIGGERING_ACTOR}}"},{"keyname":"Actions ID","value":"${{GITHUB.RUN_ID}}","type":1,"url":"https://github.com/${{GITHUB.REPOSITORY}}/actions/runs/${{GITHUB.RUN_ID}}"},{"keyname":"构建成果","value":"http://nyist-cips.github.io/netboot/"}],"jump_list":[{"type":1,"url":"https://github.com/${{GITHUB.REPOSITORY}}","title":"${{GITHUB.REPOSITORY}} 仓库页面"}],"card_action":{"type":1,"url":"https://github.com/${{GITHUB.REPOSITORY}}"}}'
#- name: Upload buildout to Wecom
# uses: MeanZhang/wecom-group-robot@v1
# with:
# key: ${{ secrets.WECHAT_WEBHOOK_KEY }}
# msgtype: "file"
# content: "buildout/buildout.zip"