Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update release action #11361

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create Release Pull Request
name: Create Release Changelog & Version Bump Pull Request

on:
workflow_dispatch:
Expand Down Expand Up @@ -43,14 +43,10 @@ jobs:
cache: yarn
- name: Install dependencies
run: yarn --immutable
- name: Set Versions
id: set-versions
shell: bash
run: SEMVER_VERSION=${{ github.event.inputs.semver-version }} VERSION_NUMBER=${{ github.event.inputs.version-number }} yarn set-version
- name: Create Release PR
id: create-release-pr
- name: Create Changelog and Version Bump PR
id: create-changelog-version-bump-pr
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./scripts/create-release-pr.sh ${{ github.event.inputs.previous-version-tag }} ${{ github.event.inputs.semver-version }}
./scripts/create-release-pr.sh ${{ github.event.inputs.previous-version-tag }} ${{ github.event.inputs.semver-version }} ${{ github.event.inputs.version-number }}
66 changes: 27 additions & 39 deletions scripts/create-release-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,47 @@ set -o pipefail

PREVIOUS_VERSION="${1}"
NEW_VERSION="${2}"
VERSION_NUMBER="${3}"
RELEASE_BRANCH_PREFIX="release/"
SEMVER_VERSION="${NEW_VERSION}"

if [[ -z $NEW_VERSION ]]; then
echo "Error: No new version specified."
exit 1
fi
# if [[ -z $NEW_VERSION ]]; then
# echo "Error: No new version specified."
# exit 1
# fi

RELEASE_BRANCH_NAME="${RELEASE_BRANCH_PREFIX}${NEW_VERSION}"
CHANGELOG_BRANCH_NAME="chore/${NEW_VERSION}-Changelog"
RELEASE_BODY="This is the release candidate for version ${NEW_VERSION}. The changelog will be found in another PR ${CHANGELOG_BRANCH_NAME}."

git config user.name metamaskbot
git config user.email metamaskbot@users.noreply.github.com

git checkout -b "${RELEASE_BRANCH_NAME}"

if ! (git add . && git commit -m "${NEW_VERSION}");
then
echo "Error: No changes detected."
exit 1
fi

git push --set-upstream origin "${RELEASE_BRANCH_NAME}"

gh pr create \
--draft \
--title "feat: ${NEW_VERSION}" \
--body "${RELEASE_BODY}" \
--head "${RELEASE_BRANCH_NAME}";

echo "Checkout release branch"
git checkout "${RELEASE_BRANCH_NAME}"

echo "Checkout new chore branch"
git checkout -b "${CHANGELOG_BRANCH_NAME}"

# #Generate version bump, changelog and test plan csv
# yarn set-version
# node ./scripts/generate-rc-commits.mjs "${PREVIOUS_VERSION}" "${RELEASE_BRANCH_NAME}"
# ./scripts/changelog-csv.sh "${RELEASE_BRANCH_NAME}"

#Generate changelog and test plan csv
node ./scripts/generate-rc-commits.mjs "${PREVIOUS_VERSION}" "${RELEASE_BRANCH_NAME}"
./scripts/changelog-csv.sh "${RELEASE_BRANCH_NAME}"

git add ./commits.csv
# git add ./commits.csv

if ! (git commit -am "updated changelog and generated feature test plan");
then
echo "Error: No changes detected."
exit 1
fi
# if ! (git commit -am "updated changelog and generated feature test plan");
# then
# echo "Error: No changes detected."
# exit 1
# fi

PR_BODY="This is PR updateds the change log for ${NEW_VERSION} and generates the test plan here [commit.csv](https://github.com/MetaMask/metamask-mobile/blob/${RELEASE_BRANCH_NAME}/commits.csv)"
# PR_BODY="This is PR updateds the change log for ${NEW_VERSION} and generates the test plan here [commit.csv](https://github.com/MetaMask/metamask-mobile/blob/${RELEASE_BRANCH_NAME}/commits.csv)"

git push --set-upstream origin "${CHANGELOG_BRANCH_NAME}"
# git push --set-upstream origin "${CHANGELOG_BRANCH_NAME}"

gh pr create \
--draft \
--title "chore: ${CHANGELOG_BRANCH_NAME}" \
--body "${PR_BODY}" \
--base "${RELEASE_BRANCH_NAME}" \
--head "${CHANGELOG_BRANCH_NAME}";
# gh pr create \
# --draft \
# --title "chore: ${CHANGELOG_BRANCH_NAME}" \
# --body "${PR_BODY}" \
# --base "${RELEASE_BRANCH_NAME}" \
# --head "${CHANGELOG_BRANCH_NAME}";
Loading