generated from MetaMask/metamask-module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 4
147 lines (141 loc) · 5.8 KB
/
create-release-pr.yml
File metadata and controls
147 lines (141 loc) · 5.8 KB
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
name: Create Release Pull Request
on:
workflow_call:
inputs:
checkout-base-branch:
required: true
type: string
description: 'The base branch, tag, or SHA for git operations.'
release-pr-base-branch:
required: true
type: string
description: 'The base branch, tag, or SHA for the release pull request.'
semver-version:
required: true
type: string
description: 'A semantic version. eg: x.x.x'
mobile-build-version:
required: false
type: string
description: 'The build version for the mobile platform.'
previous-version-ref:
required: true
type: string
description: 'Previous release version tag or branch name. eg: v7.7.0'
# Flag to indicate if the release is a test release for development purposes only
mobile-template-sheet-id:
required: false
type: string
description: 'The Mobile testing sheet template id.'
default: '1012668681' # prod sheet template
extension-template-sheet-id:
required: false
type: string
description: 'The Extension testing sheet template id.'
default: '295804563' # prod sheet template
test-only:
required: false
type: string
description: 'If true, the release will be marked as a test release.'
default: 'false'
# possible values are [ mobile, extension ]
release-sheet-google-document-id:
required: false
type: string
description: 'The Google Document ID for the release notes.'
default: '1tsoodlAlyvEUpkkcNcbZ4PM9HuC9cEM80RZeoVv5OCQ' # Prod Release Document
platform:
required: true
type: string
description: 'The platform for which the release PR is being created.'
github-tools-version:
type: string
description: 'The version of github-tools to use. Defaults to main.'
default: 'main'
git-user-name:
type: string
description: 'Git user name for commits. Defaults to metamaskbot.'
default: 'metamaskbot'
git-user-email:
type: string
description: 'Git user email for commits. Defaults to metamaskbot@users.noreply.github.com.'
default: 'metamaskbot@users.noreply.github.com'
secrets:
github-token:
required: true
description: 'GitHub token used for authentication.'
google-application-creds-base64:
required: true
description: 'Google application credentials base64 encoded.'
jobs:
create-release-pr:
name: Create Release Pull Request
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
# Step 1: Checkout invoking repository (metamask-mobile | metamask-extension )
- name: Checkout invoking repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.checkout-base-branch }}
token: ${{ secrets.github-token }}
# Step 2: Checkout github-tools repository
- name: Checkout github-tools repository
uses: actions/checkout@v4
with:
repository: MetaMask/github-tools
ref: ${{ inputs.github-tools-version }}
path: github-tools
# Step 3: Setup environment from github-tools
- name: Checkout and setup environment
uses: ./github-tools/.github/actions/checkout-and-setup
with:
is-high-risk-environment: true
# Step 4: Print Input Values
- name: Print Input Values
run: |
echo "Input Values:"
echo "-------------"
echo "Platform: ${{ inputs.platform }}"
echo "Checkout Base Branch: ${{ inputs.checkout-base-branch }}"
echo "Release PR Base Branch: ${{ inputs.release-pr-base-branch }}"
echo "Semver Version: ${{ inputs.semver-version }}"
echo "Previous Version Reference: ${{ inputs.previous-version-ref }}"
echo "Test Only Mode: ${{ inputs.test-only }}"
if [[ "${{ inputs.platform }}" == "mobile" ]]; then
echo "Mobile Build Version: ${{ inputs.mobile-build-version }}"
fi
echo "Mobile Template Sheet ID: ${{ inputs.mobile-template-sheet-id }}"
echo "Extension Template Sheet ID: ${{ inputs.extension-template-sheet-id }}"
echo "Release Sheet Google Document ID: ${{ inputs.release-sheet-google-document-id }}"
echo "GitHub Tools Version: ${{ inputs.github-tools-version }}"
echo "Git User Name: ${{ inputs.git-user-name }}"
echo "Git User Email: ${{ inputs.git-user-email }}"
echo "-------------"
# Step 5: Create Release PR
- name: Create Release PR
id: create-release-pr
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.github-token }}
BASE_BRANCH: ${{ inputs.release-pr-base-branch }}
GITHUB_REPOSITORY_URL: '${{ github.server_url }}/${{ github.repository }}'
TEST_ONLY: ${{ inputs.test-only }}
GOOGLE_DOCUMENT_ID: ${{ inputs.release-sheet-google-document-id }}
GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.google-application-creds-base64 }}
NEW_VERSION: ${{ inputs.semver-version }}
MOBILE_TEMPLATE_SHEET_ID: ${{ inputs.mobile-template-sheet-id }}
EXTENSION_TEMPLATE_SHEET_ID: ${{ inputs.extension-template-sheet-id }}
working-directory: ${{ github.workspace }}
run: |
# Execute the script from github-tools
./github-tools/.github/scripts/create-platform-release-pr.sh \
${{ inputs.platform }} \
${{ inputs.previous-version-ref }} \
${{ inputs.semver-version }} \
${{ inputs.mobile-build-version }} \
${{ inputs.git-user-name }} \
${{ inputs.git-user-email }}