-
Notifications
You must be signed in to change notification settings - Fork 13
109 lines (107 loc) · 3.32 KB
/
ogp_builder.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
name: OGP Builder
on:
workflow_dispatch:
push:
branches:
- master
jobs:
build:
runs-on: macos-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- uses: actions/checkout@v2
with:
ref: ${{ steps.extract_branch.outputs.branch }}
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile
- run: yarn run test
- run: yarn run generate:deploy
- run: pip3 install selenium
- run: (python3 -m http.server --directory ./dist 8000 &) ; python3 ./ui-test/ogp_screenshot.py
- name: Upload screenshot
uses: actions/upload-artifact@v1
with:
name: ogp
path: ogp
upload:
needs: build
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- uses: actions/checkout@v2
with:
ref: ${{ steps.extract_branch.outputs.branch }}
- name: Download ogp images
uses: actions/download-artifact@v1
with:
name: ogp
- name: Setup Git
run: |
git config user.email "[email protected]"
git config user.name "GitHub Action"
git remote add original "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Branch protection OFF
uses: octokit/[email protected]
with:
route: PUT /repos/:repository/branches/master/protection
repository: ${{ github.repository }}
required_status_checks: |
null
enforce_admins: |
null
required_pull_request_reviews: |
null
restrictions: |
null
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Commit files
run: |
cp -rp ogp static/
git add static
git commit -m "Add changes"
- name: Push changes
run: |
git push original master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Branch Protection ON
uses: octokit/[email protected]
with:
route: PUT /repos/:repository/branches/master/protection
repository: ${{ github.repository }}
mediaType: |
previews:
- luke-cage
required_status_checks: |
null
enforce_admins: |
true
required_pull_request_reviews: |
dismiss_stale_reviews: true
required_approving_review_count: 1
restrictions: |
null
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}