|
| 1 | +name: Create Release Pull Request |
| 2 | +description: 'Creates a release pull request for the specified platform (mobile or extension).' |
| 3 | + |
| 4 | +inputs: |
| 5 | + checkout-base-branch: |
| 6 | + required: true |
| 7 | + description: 'The base branch, tag, or SHA for git operations.' |
| 8 | + release-pr-base-branch: |
| 9 | + required: true |
| 10 | + description: 'The base branch, tag, or SHA for the release pull request.' |
| 11 | + semver-version: |
| 12 | + required: true |
| 13 | + description: 'A semantic version, e.g.: "x.y.z".' |
| 14 | + mobile-build-version: |
| 15 | + required: false |
| 16 | + description: 'The build version for the mobile platform.' |
| 17 | + previous-version-ref: |
| 18 | + required: true |
| 19 | + description: 'Previous release version branch name, tag or commit hash (e.g., release/7.7.0, v7.7.0, or 76fbc500034db9779e9ff7ce637ac5be1da0493d). For hotfix releases, pass the literal string "null".' |
| 20 | + mobile-template-sheet-id: |
| 21 | + required: false |
| 22 | + description: 'The Mobile testing sheet template id.' |
| 23 | + default: '1012668681' # prod sheet template |
| 24 | + extension-template-sheet-id: |
| 25 | + required: false |
| 26 | + description: 'The Extension testing sheet template id.' |
| 27 | + default: '295804563' # prod sheet template |
| 28 | + test-only: |
| 29 | + required: false |
| 30 | + description: 'If true, the release will be marked as a test release.' |
| 31 | + default: 'false' |
| 32 | + release-sheet-google-document-id: |
| 33 | + required: false |
| 34 | + description: 'The Google Document ID for the release notes.' |
| 35 | + default: '1tsoodlAlyvEUpkkcNcbZ4PM9HuC9cEM80RZeoVv5OCQ' # Prod Release Document |
| 36 | + platform: |
| 37 | + required: true |
| 38 | + description: 'The platform for which the release PR is being created. Must be one of: mobile, extension.' |
| 39 | + git-user-name: |
| 40 | + description: 'Git user name for commits. Defaults to metamaskbot.' |
| 41 | + default: 'metamaskbot' |
| 42 | + git-user-email: |
| 43 | + description: 'Git user email for commits. Defaults to [email protected].' |
| 44 | + |
| 45 | + github-token: |
| 46 | + description: 'GitHub token used for authentication.' |
| 47 | + required: true |
| 48 | + google-application-creds-base64: |
| 49 | + description: 'Google application credentials base64 encoded.' |
| 50 | + required: true |
| 51 | + github-tools-repository: |
| 52 | + description: 'The GitHub repository containing the GitHub tools. Defaults to the GitHub tools action repositor, and usually does not need to be changed.' |
| 53 | + required: false |
| 54 | + default: ${{ github.action_repository }} |
| 55 | + github-tools-ref: |
| 56 | + description: 'The SHA of the action to use. Defaults to the current action ref, and usually does not need to be changed.' |
| 57 | + required: false |
| 58 | + default: ${{ github.action_ref }} |
| 59 | + |
| 60 | +runs: |
| 61 | + using: composite |
| 62 | + steps: |
| 63 | + # Step 1: Checkout invoking repository (metamask-mobile | metamask-extension ) |
| 64 | + - name: Checkout invoking repository |
| 65 | + uses: actions/checkout@v4 |
| 66 | + with: |
| 67 | + fetch-depth: 0 |
| 68 | + ref: ${{ inputs.checkout-base-branch }} |
| 69 | + token: ${{ inputs.github-token }} |
| 70 | + |
| 71 | + # Step 2: Checkout github-tools repository |
| 72 | + - name: Checkout github-tools repository |
| 73 | + uses: actions/checkout@v4 |
| 74 | + with: |
| 75 | + repository: ${{ inputs.github-tools-repository }} |
| 76 | + ref: ${{ inputs.github-tools-ref }} |
| 77 | + path: github-tools |
| 78 | + |
| 79 | + # Step 3: Setup environment |
| 80 | + - name: Checkout and setup environment |
| 81 | + uses: MetaMask/action-checkout-and-setup@v2 |
| 82 | + with: |
| 83 | + is-high-risk-environment: true |
| 84 | + |
| 85 | + # Step 4: Print Input Values |
| 86 | + - name: Print Input Values |
| 87 | + env: |
| 88 | + PLATFORM: ${{ inputs.platform }} |
| 89 | + CHECKOUT_BASE_BRANCH: ${{ inputs.checkout-base-branch }} |
| 90 | + RELEASE_PR_BASE_BRANCH: ${{ inputs.release-pr-base-branch }} |
| 91 | + SEMVER_VERSION: ${{ inputs.semver-version }} |
| 92 | + PREVIOUS_VERSION_REF: ${{ inputs.previous-version-ref }} |
| 93 | + TEST_ONLY: ${{ inputs.test-only }} |
| 94 | + MOBILE_BUILD_VERSION: ${{ inputs.mobile-build-version }} |
| 95 | + MOBILE_TEMPLATE_SHEET_ID: ${{ inputs.mobile-template-sheet-id }} |
| 96 | + EXTENSION_TEMPLATE_SHEET_ID: ${{ inputs.extension-template-sheet-id }} |
| 97 | + RELEASE_SHEET_GOOGLE_DOCUMENT_ID: ${{ inputs.release-sheet-google-document-id }} |
| 98 | + GIT_USER_NAME: ${{ inputs.git-user-name }} |
| 99 | + GIT_USER_EMAIL: ${{ inputs.git-user-email }} |
| 100 | + shell: bash |
| 101 | + run: | |
| 102 | + echo "Input Values:" |
| 103 | + echo "-------------" |
| 104 | + echo "Platform: $PLATFORM" |
| 105 | + echo "Checkout Base Branch: $CHECKOUT_BASE_BRANCH" |
| 106 | + echo "Release PR Base Branch: $RELEASE_PR_BASE_BRANCH" |
| 107 | + echo "Semver Version: $SEMVER_VERSION" |
| 108 | + echo "Previous Version Reference: $PREVIOUS_VERSION_REF" |
| 109 | + echo "Test Only Mode: $TEST_ONLY" |
| 110 | + if [[ "$PLATFORM" == "mobile" ]]; then |
| 111 | + echo "Mobile Build Version: $MOBILE_BUILD_VERSION" |
| 112 | + fi |
| 113 | + echo "Mobile Template Sheet ID: $MOBILE_TEMPLATE_SHEET_ID" |
| 114 | + echo "Extension Template Sheet ID: $EXTENSION_TEMPLATE_SHEET_ID" |
| 115 | + echo "Release Sheet Google Document ID: $RELEASE_SHEET_GOOGLE_DOCUMENT_ID" |
| 116 | + echo "Git User Name: $GIT_USER_NAME" |
| 117 | + echo "Git User Email: $GIT_USER_EMAIL" |
| 118 | + echo "-------------" |
| 119 | +
|
| 120 | + # Step 5: Create Release PR |
| 121 | + - name: Create Release PR |
| 122 | + id: create-release-pr |
| 123 | + shell: bash |
| 124 | + env: |
| 125 | + GITHUB_TOKEN: ${{ inputs.github-token }} |
| 126 | + BASE_BRANCH: ${{ inputs.release-pr-base-branch }} |
| 127 | + GITHUB_REPOSITORY_URL: '${{ github.server_url }}/${{ github.repository }}' |
| 128 | + TEST_ONLY: ${{ inputs.test-only }} |
| 129 | + GOOGLE_DOCUMENT_ID: ${{ inputs.release-sheet-google-document-id }} |
| 130 | + GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ inputs.google-application-creds-base64 }} |
| 131 | + NEW_VERSION: ${{ inputs.semver-version }} |
| 132 | + MOBILE_TEMPLATE_SHEET_ID: ${{ inputs.mobile-template-sheet-id }} |
| 133 | + EXTENSION_TEMPLATE_SHEET_ID: ${{ inputs.extension-template-sheet-id }} |
| 134 | + PLATFORM: ${{ inputs.platform }} |
| 135 | + PREVIOUS_VERSION_REF: ${{ inputs.previous-version-ref }} |
| 136 | + SEMVER_VERSION: ${{ inputs.semver-version }} |
| 137 | + MOBILE_BUILD_VERSION: ${{ inputs.mobile-build-version }} |
| 138 | + GIT_USER_NAME: ${{ inputs.git-user-name }} |
| 139 | + GIT_USER_EMAIL: ${{ inputs.git-user-email }} |
| 140 | + working-directory: ${{ github.workspace }} |
| 141 | + run: | |
| 142 | + # Execute the script from github-tools |
| 143 | + ./github-tools/.github/scripts/create-platform-release-pr.sh \ |
| 144 | + "$PLATFORM" \ |
| 145 | + "$PREVIOUS_VERSION_REF" \ |
| 146 | + "$SEMVER_VERSION" \ |
| 147 | + "$MOBILE_BUILD_VERSION" \ |
| 148 | + "$GIT_USER_NAME" \ |
| 149 | + "$GIT_USER_EMAIL" |
| 150 | +
|
| 151 | + # Step 6: Upload commits.csv as artifact (if generated) |
| 152 | + - name: Upload commits.csv artifact |
| 153 | + if: ${{ hashFiles('commits.csv') != '' }} |
| 154 | + uses: actions/upload-artifact@v4 |
| 155 | + with: |
| 156 | + name: commits-csv |
| 157 | + path: commits.csv |
| 158 | + if-no-files-found: error |
0 commit comments