Skip to content

Commit 1cf8988

Browse files
authored
build: Add size limit info to releases (#7203)
1 parent 68655e3 commit 1cf8988

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ jobs:
275275
needs: [job_get_metadata, job_build]
276276
timeout-minutes: 15
277277
runs-on: ubuntu-20.04
278-
if: github.event_name == 'pull_request' || needs.job_get_metadata.outputs.is_develop == 'true'
278+
if: github.event_name == 'pull_request' || needs.job_get_metadata.outputs.is_develop == 'true' || needs.job_get_metadata.outputs.is_release == 'true'
279279
steps:
280280
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
281281
uses: actions/checkout@v3
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Add size info to release
2+
on:
3+
release:
4+
types:
5+
- published
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: Which version to add size info for
10+
required: false
11+
12+
# This workflow is triggered when a release is published
13+
# It fetches the size-limit info from the release branch and adds it to the release
14+
jobs:
15+
release-size-info:
16+
runs-on: ubuntu-20.04
17+
name: 'Add size-limit info to release'
18+
19+
steps:
20+
# https://github.com/actions-ecosystem/action-regex-match
21+
- uses: actions-ecosystem/action-regex-match@v2
22+
id: head_version
23+
with:
24+
# Parse version from head ref, which is refs/tags/<tag_name>
25+
text: ${{ github.head_ref }}
26+
regex: '^refs\/tags\/([\d.]+)$'
27+
28+
- name: Get version
29+
id: get_version
30+
run: echo "version=${{ github.event.inputs.version || steps.head_version.outputs.match }}" >> $GITHUB_OUTPUT
31+
32+
- name: Update Github Release
33+
if: steps.get_version.outputs.version != ''
34+
uses: getsentry/size-limit-release@v1
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
version: ${{ steps.get_version.outputs.version }}
38+
workflow_name: 'Build & Test'

0 commit comments

Comments
 (0)