-
Notifications
You must be signed in to change notification settings - Fork 24
153 lines (126 loc) · 4.71 KB
/
web-ui-automation.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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# This is a CI for Prysm Web UI
name: Prysm Web CI
# Specify tags allowed
on:
push:
tags:
- '*'
jobs:
# Build job for Prysm Web ui
build_and_release:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Automated steps for the release
steps:
- uses: actions/checkout@v2
with:
path: main
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "16.x"
path: main
- name: Install dependencies
run: cd main && npm install
- name: Node build step for prod
run: cd main && npm run build:prod
- name: Archive the release
run: cd main/dist && tar -czvf ../prysm-web-ui.tar.gz .
- name: Create shasum
run: cd main && shasum -a 256 prysm-web-ui.tar.gz | awk '{print $1}' > prysm-web-ui.tar.gz.sha256sum
- name: Define shasum variable
id: new_shasum
run: cd main && echo "::set-output name=SHA::$(cat prysm-web-ui.tar.gz.sha256sum)"
- name: Create release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: Release-${{ github.ref }}
tag_name: ${{ github.ref }}
body_path: ./main/CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload archived artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./main/prysm-web-ui.tar.gz
asset_name: prysm-web-ui.tar.gz
asset_content_type: application/gzip
- name: Upload checksum artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./main/prysm-web-ui.tar.gz.sha256sum
asset_name: prysm-web-ui.tar.gz.sha256sum
asset_content_type: application/sha256sum
- name: Get previous tag version
id: previous_version
run: cd main && echo "::set-output name=TAG_NAME::$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`)"
outputs:
new_sha: ${{ steps.new_shasum.outputs.SHA }}
old_tag: ${{ steps.previous_version.outputs.TAG_NAME }}
# Job for Prysm WORKSPACE modification and pull request
prysm_pull_request:
needs: build_and_release
runs-on: ubuntu-latest
steps:
- name: Checkout tools repo
uses: actions/checkout@v3
with:
repository: prysmaticlabs/prysm
path: prysm_repo
ref: develop
- name: Git pull
run: cd prysm_repo && git pull
- name: Get Current Tag
id: current_version
run: cd prysm_repo && echo ::set-output name=TAG::${GITHUB_REF#refs/*/}
- name: Replace Tag
uses: jacobtomlinson/gha-find-replace@v2
with:
find: ${{ needs.build_and_release.outputs.old_tag }}
replace: ${{ steps.current_version.outputs.TAG }}
include: "prysm_repo/WORKSPACE"
- name: Get the previous shasum
run: wget https://github.com/prysmaticlabs/prysm-web-ui/releases/download/${{ needs.build_and_release.outputs.old_tag }}/prysm-web-ui.tar.gz.sha256sum
- name: Get previous release shasum value
id: previous_shasum
run: echo "::set-output name=SHASUM::$(cat prysm-web-ui.tar.gz.sha256sum | awk '{print $1}')"
- name: Replace SHA
uses: jacobtomlinson/gha-find-replace@v2
with:
find: ${{ steps.previous_shasum.outputs.SHASUM }}
replace: ${{ needs.build_and_release.outputs.new_sha }}
include: "prysm_repo/WORKSPACE"
- name: Setup bazel
uses: jwlawson/actions-setup-bazel@v1
with:
bazel-version: '5.4.0'
- name: Run Bazel
run: cd prysm_repo && bazel build //validator/web:site_data
- name: Copy build site data
run: cd prysm_repo && cp bazel-bin/validator/web/site_data.go ./validator/web/site_data.go
- name: Run go FMT
run: cd prysm_repo && gofmt -w -s ./validator/web/site_data.go
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: Web-ui-version-${{ steps.current_version.outputs.TAG }}-commit
title: 'Prysm Web UI Release ${{ steps.current_version.outputs.TAG }}'
body: >
This PR is auto-generated by
[create-pull-request](https://github.com/peter-evans/create-pull-request).
labels: automated pr
path: prysm_repo
#reviewers: rauljordan, james-prysm
token: ${{ secrets.PAToken }}
branch: prysm-web-ui-${{ steps.current_version.outputs.TAG }}
base: develop