forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d94b897
commit 338563e
Showing
5 changed files
with
186 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: "chore: Update to upstream release `{{ env.RELEASE_TAG }}`" | ||
labels: automated-issue | ||
--- | ||
|
||
A new Aptos PFN release `{{ env.RELEASE_TAG }}` is available at {{ env.UPSTREAM_URL }}. | ||
|
||
A new branch associated with these changes was pushed locally at `upstream/{{ env.RELEASE_TAG }}`. | ||
|
||
Steps to release an upgraded patched version: | ||
- Rebase `dev` onto the changes from `upstream/{{ env.RELEASE_TAG }}` as follows: | ||
``` | ||
git remote add upstream https://github.com/aptos-labs/aptos-core.git | ||
git reset --hard refs/tags/{{ env.RELEASE_TAG }} | ||
# TODO: Merge into one commit for simplicity | ||
git cherry-pick 7c9a8bcd79376cf1479a3432b48127a56945cabb | ||
git cherry-pick d14dc0c286e704883ca453a40ab4531702c86f71 | ||
git cherry-pick 15f91a32989ea63224064862167136b17baf1128 | ||
git cherry-pick <CI-commits> | ||
git push origin dev -f | ||
``` | ||
- Then, run the [release workflow]({{ env.RELEASE_PR_WORKFLOW }}) and set the version input to `{{ env.RELEASE_TAG }}`. This will bump the version number in `PATCH_RELEASE.md` (since there is no Cargo version for the Aptos node) and open a PR from `release/{{ env.RELEASE_TAG }}-patched` to `dev`. The PR will run CI checks and provide an artifact for downstream companion PRs to test on. | ||
- When the PR is merged, it will automatically publish a GitHub release for `{{ env.RELEASE_TAG }}-patched` using the [merge workflow]({{ env.RELEASE_MERGE_WORKFLOW }}). | ||
|
||
This issue was created by the workflow at {{ env.WORKFLOW_URL }} | ||
|
||
TODO: Move these instructions to separate patch-notes.md file and link to it here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Aptos LC - Create Patched Release PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
type: | ||
description: 'release or hotfix' | ||
type: choice | ||
options: | ||
- release | ||
- hotfix | ||
required: true | ||
# Tag version to patch, e.g. `aptos-node-v1.13.3` | ||
version: | ||
description: 'Release tag patched' | ||
required: true | ||
|
||
jobs: | ||
release-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git config | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global url."https://${{ secrets.REPO_TOKEN }}@github.com/".insteadOf ssh://[email protected] | ||
git config --global url."https://${{ secrets.REPO_TOKEN }}@github.com".insteadOf https://github.com | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set base branch | ||
run: | | ||
if [[ "${{ inputs.type == 'hotfix' }}" == "true" ]]; then | ||
BASE_BRANCH="release/${{ inputs.version }}-patched" | ||
else | ||
BASE_BRANCH="main" | ||
fi | ||
echo "BASE_BRANCH=$BASE_BRANCH" | tee -a $GITHUB_ENV | ||
echo "PR_BRANCH=${{ inputs.type }}/${{ inputs.version }}-patched" | tee -a $GITHUB_ENV | ||
echo "PR_DESCRIPTION=chore: Release ${{ inputs.version }}-patched" | tee -a $GITHUB_ENV | ||
# TODO: Need some change for the PR to be possible, so recording the version change in `PATCH_RELEASE.md` since we're not using `Cargo.toml` | ||
- name: Edit tag version in PATCH_RELEASE.md | ||
run: | | ||
git fetch origin | ||
# NOTE: Release branch must not exist already. If it does, use the `hotfix` input type to change it as any `release/*` branch is load-bearing | ||
if [[ "${{ inputs.type }}" == "release" ]]; then | ||
git checkout -b ${{ env.PR_BRANCH }} | ||
else | ||
git checkout ${{ env.PR_BRANCH }} | ||
fi | ||
if [[ ! -s "PATCH_RELEASE.md" ]]; then | ||
counter=1 | ||
else | ||
counter=$(awk '{print $NF}' "$PATCH_RELEASE.md") | ||
if [[ "$counter" =~ ^[0-9]+$ ]]; then | ||
# Increment the variable | ||
((counter++)) | ||
else | ||
counter=1 | ||
fi | ||
fi | ||
echo "Version ${{ inputs.version }} - release $counter" | tee PATCH_RELEASE.md | ||
git add . | ||
git commit -m "${{ env.PR_DESCRIPTION }}" | ||
git push origin ${{ env.PR_BRANCH }} | ||
# Note: Can't use `peter-evans/create-pull-request` because for hotfixes we need to make the PR with an existing branch | ||
# The above action always creates a new one for single-commit PRs, thus overwriting the actual hotfix | ||
- name: Create PR | ||
run: | | ||
cat << 'EOF' > body.md | ||
This is an automated release PR for the patched version of `${{ inputs.version }}`. | ||
Upstream changelog: https://github.com/aptos-labs/aptos-core/releases/tag/${{ inputs.version }} | ||
On merge, this will trigger the [release publish workflow](${{ github.server_url }}/${{ github.repository }}/actions/workflows/aptos-light-client-patch-release-publish.yml), which will upload a new GitHub release with tag `{{ inputs.version }}-patched`. | ||
[Workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | ||
EOF | ||
gh pr create --title "${{ env.PR_DESCRIPTION }}" --body-file ./body.md --head ${{ env.PR_BRANCH }} --base ${{ env.BASE_BRANCH }} | ||
env: | ||
GH_TOKEN: ${{ github.token }} |
54 changes: 54 additions & 0 deletions
54
.github/workflows/aptos-light-client-patch-release-publish.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Aptos LC - Publish Patched Release | ||
|
||
on: | ||
pull_request: | ||
types: [ closed ] | ||
branches: | ||
- release/* | ||
- dev | ||
|
||
jobs: | ||
release-pr: | ||
runs-on: ubuntu-latest | ||
if: | | ||
github.event.pull_request.merged == true && | ||
((startsWith(github.event.pull_request.head.ref, 'release/') && github.event.pull_request.base.ref == 'dev') || | ||
(startsWith(github.event.pull_request.head.ref, 'hotfix/') && startsWith(github.event.pull_request.base.ref, 'release/'))) | ||
steps: | ||
- name: Git config | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global url."https://${{ secrets.REPO_TOKEN }}@github.com/".insteadOf ssh://[email protected] | ||
git config --global url."https://${{ secrets.REPO_TOKEN }}@github.com".insteadOf https://github.com | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get version | ||
id: get-version | ||
run: | | ||
VERSION=$(echo "${{ github.event.pull_request.head.ref }}" | cut -d'/' -f 2) | ||
RELEASE_BRANCH="${{ startsWith(github.event.pull_request.head.ref, 'release/') && github.event.pull_request.head.ref || github.event.pull_request.base.ref }}" | ||
git tag -a $VERSION -m "$VERSION" $RELEASE_BRANCH | ||
git push origin $VERSION -f | ||
echo "version=$VERSION" | tee -a "$GITHUB_OUTPUT" | ||
echo "RELEASE_BRANCH=$RELEASE_BRANCH" | tee -a "$GITHUB_ENV" | ||
- name: Build Changelog | ||
id: github_release | ||
uses: mikepenz/release-changelog-builder-action@v4 | ||
with: | ||
toTag: ${{ steps.get-version.outputs.version }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
body: ${{ steps.github_release.outputs.changelog }} | ||
tag: ${{ steps.get-version.outputs.version }} | ||
commit: ${{ env.RELEASE_BRANCH }} | ||
allowUpdates: true |
26 changes: 0 additions & 26 deletions
26
.github/workflows/aptos-light-client-patch-release-tag.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters