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

FOR REVIEW ONLY: js-algorand-sdk v2.5.0 #814

Merged
merged 8 commits into from
Aug 17, 2023
Merged
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
orbs:
node: circleci/node@5.0.0
slack: circleci/slack@4.4.2
browser-tools: circleci/browser-tools@1.2.4
browser-tools: circleci/browser-tools@1.4.3
gh-pages: sugarshin/gh-pages@1.0.0

parameters:
Expand Down
210 changes: 210 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
name: Create Release PR

on:
workflow_dispatch:
inputs:
release_version:
description: 'The release_version used for the release branch name, e.g. release/vx.x.x'
default: 'vx.x.x'
required: true
type: string
pre_release_version:
description: "Pre-Release version, e.g. 'beta.1'"
required: false
type: string

env:
RELEASE_VERSION: ${{ inputs.release_version }}
PRE_RELEASE_VERSION: ${{ inputs.pre_release_version }}
RELEASE_BRANCH: release/${{ inputs.release_version }}

jobs:
create-release-pr:
runs-on: ubuntu-latest

steps:
- name: Set Release Version and Branch to Check Out
id: set-release
run: |
if [[ $RELEASE_VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
if [[ $PRE_RELEASE_VERSION =~ ^[a-z.0-9]+$ ]]; then
echo "release-tag: $RELEASE_VERSION-$PRE_RELEASE_VERSION"
echo "release-tag=$RELEASE_VERSION-$PRE_RELEASE_VERSION" >> $GITHUB_OUTPUT
elif [[ -n $PRE_RELEASE_VERSION ]]; then
echo "Input pre_release_version is not empty, but does not match the regex pattern ^[-a-z0-9]+$"
exit 1
else
echo "release-tag: $RELEASE_VERSION"
echo "release-tag=$RELEASE_VERSION" >> $GITHUB_OUTPUT
fi
else
echo "Version input doesn't match the regex pattern ^[0-9]+\.[0-9]+\.[0-9]+$"
exit 1
fi

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Create Release Branch if it does not exist
run: |
if ! git show-ref --verify --quiet "refs/remotes/origin/$RELEASE_BRANCH"; then
git checkout -b $RELEASE_BRANCH
git push --set-upstream origin $RELEASE_BRANCH
elif [[ $(git rev-parse --abbrev-ref HEAD) != "$RELEASE_BRANCH" ]]; then
echo "Current Branch: $(git rev-parse --abbrev-ref HEAD)"
echo "Release branch exists, make sure you're using the workflow from the release branch or delete the existing release branch."
exit 1
else
echo "Release branch exists and used as workflow ref."
fi

- name: Get Latest Release
id: get-release
run: |
if [[ -n $PRE_RELEASE_VERSION ]]; then
echo "Get the latest release"
tag=$(curl -L \
--header "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases" | jq -r '.[0].tag_name')
echo "latest-tag=$tag" >> $GITHUB_OUTPUT
else
echo "Get the latest stable release"
tag=$(curl -L \
--header "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name')
echo "latest-tag=$tag" >> $GITHUB_OUTPUT
fi

- name: Build Changelog
id: build-changelog
env:
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }}
run: |
CHANGELOG=$(curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \
-d '{"tag_name":"${{ env.RELEASE_VERSION }}","target_commitish":"${{ env.RELEASE_BRANCH }}","previous_tag_name":"${{ env.PREVIOUS_VERSION }}","configuration_file_path":".github/release.yml"}' \
| jq -r '.body')

# The EOF steps are used to save multiline string in github:
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "changelog<<$EOF" >> $GITHUB_OUTPUT
echo -e "${CHANGELOG}" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT

- name: Update Changelog
if: ${{ env.PRE_RELEASE_VERSION == '' }}
env:
CHANGELOG_CONTENT: ${{ steps.build-changelog.outputs.changelog }}
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }}
run: |
echo -e "# ${RELEASE_VERSION}\n\n${CHANGELOG_CONTENT}\n" | cat - CHANGELOG.md > temp && mv temp CHANGELOG.md

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Update Version References in Source
env:
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
run: |
rm -rf dist node_modules
npm ci
npm run build
NEW_HASH=$(cat dist/browser/algosdk.min.js | openssl dgst -sha384 -binary | openssl base64 -A)
python3 scripts/bump_version.py ${RELEASE_TAG:1} --new_hash "${NEW_HASH}"
npx prettier --write .

- name: Commit Changes
uses: EndBug/add-and-commit@v9.1.3
env:
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
with:
message: "bump up version to ${{ env.RELEASE_TAG }}"

- name: Create Pull Request to Master
env:
CHANGELOG_CONTENT: ${{ steps.build-changelog.outputs.changelog }}
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }}
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
run: |
# Note: There's an issue adding teams as reviewers, see https://github.com/cli/cli/issues/6395
PULL_REQUEST_URL=$(gh pr create --base "master" \
--title "FOR REVIEW ONLY: ${{ github.event.repository.name }} $RELEASE_TAG" \
--label "Skip-Release-Notes" \
--label "Team Hyper Flow" \
--body "${CHANGELOG_CONTENT}" | tail -n 1)
if [[ $PULL_REQUEST_URL =~ ^https://github.com/${{ github.repository }}/pull/[0-9]+$ ]]; then
PULL_REQUEST_NUM=$(echo $PULL_REQUEST_URL | sed 's:.*/::')
echo "pull-request-master=$PULL_REQUEST_URL" >> $GITHUB_ENV
echo "pull-request-master-num=$PULL_REQUEST_NUM" >> $GITHUB_ENV
echo "Pull request to Master created: $PULL_REQUEST_URL"
else
echo "There was an issue creating the pull request to master branch."
exit 1
fi

- name: Create Pull Request to Develop
if: ${{ env.PRE_RELEASE_VERSION == '' }}
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
run: |
# Note: There's an issue adding teams as reviewers, see https://github.com/cli/cli/issues/6395
PULL_REQUEST_URL=$(gh pr create --base "develop" \
--title "FOR REVIEW ONLY: Merge back ${{ github.event.repository.name }} $RELEASE_TAG to develop" \
--label "Skip-Release-Notes" \
--label "Team Hyper Flow" \
--body "Merge back version changes to develop." | tail -n 1)
if [[ $PULL_REQUEST_URL =~ ^https://github.com/${{ github.repository }}/pull/[0-9]+$ ]]; then
echo "Pull request to Develop created: $PULL_REQUEST_URL"
DEVELOP_PR_MESSAGE="\nPull Request to develop: $PULL_REQUEST_URL"
echo "pull-request-develop-message=$DEVELOP_PR_MESSAGE" >> $GITHUB_ENV
else
echo "There was an issue creating the pull request to develop branch."
exit 1
fi

- name: Send Slack Message
id: slack
uses: slackapi/slack-github-action@v1.24.0
env:
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
SDK_DEPLOYMENT_URL: ${{ secrets.SDK_DEPLOYMENT_URL }}
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "${{ github.event.repository.name }} Release PR for ${{ env.RELEASE_TAG }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Approvals needed for*:\nPull Request to master: ${{ env.pull-request-master}}${{ env.pull-request-develop-message }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*After approvals*\nDeploy SDK using the <${{ env.SDK_DEPLOYMENT_URL }}|Deployment Pipeline> with the following parameters:\n*SDK*: ${{ github.event.repository.name }}\n*RELEASE_PR_NUM*: ${{ env.pull-request-master-num }}\n*RELEASE_VERSION*: ${{ env.RELEASE_VERSION }}\n*PRE_RELEASE_VERSION*: ${{ env.PRE_RELEASE_VERSION }}"
}
}
]
}
2 changes: 1 addition & 1 deletion .test-env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configs for testing repo download:
SDK_TESTING_URL="https://github.com/algorand/algorand-sdk-testing"
SDK_TESTING_BRANCH="master"
SDK_TESTING_BRANCH="V2"
SDK_TESTING_HARNESS="test-harness"

INSTALL_ONLY=0
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
# v2.5.0

<!-- Release notes generated using configuration in .github/release.yml at release/v2.5.0 -->

## What's Changed

### Bugfixes

- bug-fix: include currency-greater-than param for 0 value by @shiqizng in https://github.com/algorand/js-algorand-sdk/pull/807

### New Features

- Simulation: Execution trace (PC/Stack/Scratch) support by @ahangsu in https://github.com/algorand/js-algorand-sdk/pull/803

### Enhancements

- fetch: Add Cloudflare Workers support (cross-fetch v4) by @spencercap in https://github.com/algorand/js-algorand-sdk/pull/794
- logging: Add rn warning and logging by @Eric-Warehime in https://github.com/algorand/js-algorand-sdk/pull/798
- CICD: Update Chromedriver version and CI orb by @algochoi in https://github.com/algorand/js-algorand-sdk/pull/802
- CICD: Update chromedriver in package.json to 116+ by @algochoi in https://github.com/algorand/js-algorand-sdk/pull/811

## New Contributors

- @spencercap made their first contribution in https://github.com/algorand/js-algorand-sdk/pull/794

**Full Changelog**: https://github.com/algorand/js-algorand-sdk/compare/v2.4.0...v2.5.0

# v2.4.0

## What's Changed
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Include a minified browser bundle directly in your HTML like so:

```html
<script
src="https://unpkg.com/algosdk@v2.4.0/dist/browser/algosdk.min.js"
integrity="sha384-vb9VngcgEwkDszQ4wPAsk/oiOfBcbEjNG+Icx9erSJMLZCDPNp0ncx22oBM+8Xji"
src="https://unpkg.com/algosdk@v2.5.0/dist/browser/algosdk.min.js"
integrity="sha384-6PTPyb/CJ0CVqEu9Ff7ss4fpdAI0H9DgjQ1y0ftafqNMTC0I9sJvkSu1rHuWT5vf"
crossorigin="anonymous"
></script>
```
Expand All @@ -30,8 +30,8 @@ or

```html
<script
src="https://cdn.jsdelivr.net/npm/algosdk@v2.4.0/dist/browser/algosdk.min.js"
integrity="sha384-vb9VngcgEwkDszQ4wPAsk/oiOfBcbEjNG+Icx9erSJMLZCDPNp0ncx22oBM+8Xji"
src="https://cdn.jsdelivr.net/npm/algosdk@v2.5.0/dist/browser/algosdk.min.js"
integrity="sha384-6PTPyb/CJ0CVqEu9Ff7ss4fpdAI0H9DgjQ1y0ftafqNMTC0I9sJvkSu1rHuWT5vf"
crossorigin="anonymous"
></script>
```
Expand Down
Loading