-
Notifications
You must be signed in to change notification settings - Fork 27
127 lines (111 loc) · 4.72 KB
/
update_bee.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
name: Update Bee version
on:
workflow_dispatch:
inputs:
beeVersion:
description: 'Bee version (eq. 1.3.0)'
required: true
beeApiVersion:
description: 'Bee API version (eq. 1.3.0)'
required: true
beeDebugApiVersion:
description: 'Bee Debug API version (eq. 1.3.0)'
required: true
repository_dispatch:
types: [update-bee]
jobs:
create-api-docs-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Set env. variables
run: |
if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
bee_version=$(echo "${{ github.event.client_payload.beeVersion }}" | xargs )
bee_api_version=$(echo "${{ github.event.client_payload.apiVersion }}" | xargs )
bee_debug_api_version=$(echo "${{ github.event.client_payload.debugApiVersion }}" | xargs )
else
bee_version=$(echo "${{ github.event.inputs.beeVersion }}" | xargs )
bee_api_version=$(echo "${{ github.event.inputs.beeApiVersion }}" | xargs )
bee_debug_api_version=$(echo "${{ github.event.inputs.beeDebugApiVersion }}" | xargs )
fi
echo "BEE_VERSION_WITH_COMMIT=$bee_version" >> $GITHUB_ENV
echo "FINAL_CLEAN_BEE_VERSION=${bee_version/-*}" >> $GITHUB_ENV
echo "CLEAN_BEE_VERSION=${bee_version%-*}" >> $GITHUB_ENV
echo "API_VERSION=$bee_api_version" >> $GITHUB_ENV
echo "DEBUG_API_VERSION=$bee_debug_api_version" >> $GITHUB_ENV
- name: Replace Engine in package.json
uses: jossef/action-set-json-field@v1
with:
file: package.json
field: engines.bee
value: ${{ env.BEE_VERSION_WITH_COMMIT }}
- name: Replace API version in package.json
uses: jossef/action-set-json-field@v1
with:
file: package.json
field: engines.beeApiVersion
value: ${{ env.API_VERSION }}
- name: Add trailing new-line to package.json
run: printf "\n" >> package.json
- name: Replace SUPPORTED_BEE_VERSION_EXACT for Status module
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "export const SUPPORTED_BEE_VERSION_EXACT = '.*?'"
replace: "export const SUPPORTED_BEE_VERSION_EXACT = '${{ env.BEE_VERSION_WITH_COMMIT }}'"
include: 'src/modules/debug/status.ts'
regex: true
- name: Replace SUPPORTED_API_VERSION for Status module
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "export const SUPPORTED_API_VERSION = '.*?'"
replace: "export const SUPPORTED_API_VERSION = '${{ env.API_VERSION }}'"
include: 'src/modules/debug/status.ts'
regex: true
- name: Replace README version
uses: jacobtomlinson/gha-find-replace@v2
with:
find: '<!-- SUPPORTED_BEE_START -->.*?<!-- SUPPORTED_BEE_END -->'
replace: '<!-- SUPPORTED_BEE_START -->${{ env.FINAL_CLEAN_BEE_VERSION }}<!-- SUPPORTED_BEE_END -->'
include: README.md
regex: true
- name: Create/update PR
id: pr
uses: gr2m/create-or-update-pull-request-action@v1
env:
GITHUB_TOKEN: ${{ secrets.REPO_GHA_PAT }}
with:
title: 'chore: update to bee ${{ env.FINAL_CLEAN_BEE_VERSION }}'
body: 'Updated Bee version ${{ env.BEE_VERSION_WITH_COMMIT }}'
branch: 'bee-${{ env.FINAL_CLEAN_BEE_VERSION }}'
commit-message: 'chore: update to bee'
author: 'bee-worker <[email protected]>'
- uses: joutvhu/get-release@v1
id: release-notes
with:
owner: ethersphere
repo: bee
tag_name: v${{ env.CLEAN_BEE_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.REPO_GHA_PAT }}
- name: Find Release Notes comment
if: steps.pr.outputs.pull-request-number && steps.release-notes.outputs.body
uses: peter-evans/find-comment@v1
id: comment
with:
token: ${{ secrets.REPO_GHA_PAT }}
comment-author: bee-worker
issue-number: ${{ steps.pr.outputs.pull-request-number }}
body-includes: Release notes
- name: Create or update preview comment
uses: peter-evans/create-or-update-comment@v1
if: steps.pr.outputs.pull-request-number && steps.release-notes.outputs.body
with:
token: ${{ secrets.REPO_GHA_PAT }}
comment-id: ${{ steps.comment.outputs.comment-id }}
issue-number: ${{ steps.pr.outputs.pull-request-number }}
body: |
## 🗒 Bee ${{ env.CLEAN_BEE_VERSION }} Release notes
${{ steps.release-notes.outputs.body}}