Fix Tron swap UX in the TRX/USDT flow (#1126) #1111
This file contains hidden or 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
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| permissions: {} | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node.js 24.x | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 24.x | |
| - name: Enable corepack | |
| run: corepack enable && corepack prepare pnpm@10.33.0 --activate | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm run build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: relay-kit-build | |
| if-no-files-found: error | |
| retention-days: 1 | |
| path: | | |
| packages/*/_esm/** | |
| packages/*/_cjs/** | |
| packages/*/_types/** | |
| packages/*/dist/** | |
| release: | |
| name: Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Setup Node.js 24.x | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 24.x | |
| - name: Setup npm for trusted publishing | |
| run: npm i -g npm@11.5.1 | |
| - name: Enable corepack | |
| run: corepack enable && corepack prepare pnpm@10.33.0 --activate | |
| - name: Install Dependencies (no scripts) | |
| run: pnpm install --frozen-lockfile --ignore-scripts | |
| - name: Restore build artifacts | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: relay-kit-build | |
| path: packages | |
| - name: Get Open PRs Created by Bots | |
| id: get_bot_prs | |
| run: | | |
| prs=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls?state=open&per_page=100" | \ | |
| jq -r '[.[] | select(.user.type == "Bot" and (.title | contains("Release")))][0] | {url: .html_url, title: .title} | @json') | |
| echo "Found PRs: $prs" | |
| if [[ $prs == "null" || $prs == "{}" ]]; then | |
| echo "BOT_PR_TITLE=NULL" >> $GITHUB_ENV | |
| else | |
| bot_pr_title=$(echo $prs | jq -r .title) | |
| echo "BOT_PR_TITLE=$bot_pr_title" >> $GITHUB_ENV | |
| fi | |
| - name: Generate Animal Title | |
| run: | | |
| title_case() { | |
| echo "$1" | awk '{ | |
| for(i=1;i<=NF;i++){ | |
| $i=toupper(substr($i,1,1)) tolower(substr($i,2)) | |
| } | |
| }1' | |
| } | |
| responseAdj=$(curl -s "https://gist.githubusercontent.com/pedromcunha/9e0ea328b5c320264ddcdcc5e5b6ce48/raw/5ffec8da5b4300934f9bedca2707f1d4d2845f4f/adjectives.json") | |
| responseAnimal=$(curl -s "https://gist.githubusercontent.com/pedromcunha/d2b7f7b7e295cbafdd03af73bcd168ba/raw/c1d4b618da5051519c5d8ffce73d0ec6b018f356/animals.json") | |
| lengthAdj=$(echo $responseAdj | jq length) | |
| lengthAnimal=$(echo $responseAnimal | jq length) | |
| random_index1=$(($RANDOM % lengthAdj)) | |
| random_index2=$(($RANDOM % lengthAnimal)) | |
| while [ $random_index1 -eq $random_index2 ]; do | |
| random_index2=$(($RANDOM % length)) | |
| done | |
| word1=$(echo $responseAdj | jq -r ".[$random_index1].name") | |
| word2=$(echo $responseAnimal | jq -r ".[$random_index2].name") | |
| title="$word1 $word2" | |
| title="Release the: $(title_case "$title")!" | |
| echo "Title is $title" | |
| echo "RELEASE_TITLE=$title" >> $GITHUB_ENV | |
| - name: Determine Release Title | |
| run: | | |
| if [[ "${{ env.BOT_PR_TITLE }}" == "null" ]]; then | |
| echo "FINAL_RELEASE_TITLE=${{ env.RELEASE_TITLE }}" >> $GITHUB_ENV | |
| else | |
| echo "FINAL_RELEASE_TITLE=${{ env.BOT_PR_TITLE }}" >> $GITHUB_ENV | |
| fi | |
| - name: Create Release Pull Request or Publish to npm | |
| uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0 | |
| with: | |
| title: ${{ env.FINAL_RELEASE_TITLE }} | |
| publish: pnpm package:release:ci | |
| commitMode: github-api | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |