mirror of
https://github.com/zhigang1992/xverse-web-extension.git
synced 2026-04-30 13:42:52 +08:00
Merge branch 'develop' into release/v0.27.0
This commit is contained in:
132
.github/workflows/build-rc.yml
vendored
Normal file
132
.github/workflows/build-rc.yml
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
name: Build & Publish release candidate
|
||||
##
|
||||
# This workflow builds new release candidates (create release + upload asset):
|
||||
# - for a new release PR and
|
||||
# - for every push to the release PR head branch
|
||||
#
|
||||
# It should also keep the release PR description in sync with the latest release candidate
|
||||
#
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
jobs:
|
||||
test:
|
||||
if: ${{ startsWith(github.head_ref, 'release/') }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
always-auth: true
|
||||
node-version: 18
|
||||
registry-url: https://npm.pkg.github.com
|
||||
scope: '@secretkeylabs'
|
||||
cache: npm
|
||||
- name: Install dependencies
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGE_REGISTRY_TOKEN }}
|
||||
run: npm ci
|
||||
- name: Test
|
||||
run: |
|
||||
npx eslint .
|
||||
npx tsc --noEmit
|
||||
npm test
|
||||
publish-rc:
|
||||
# TODO also keep the develop PR description up to date
|
||||
if: ${{ github.base_ref == 'main' }}
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
issues: write
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
outputs:
|
||||
upload_url: ${{ steps.publish-prerelease.outputs.UPLOAD_URL }}
|
||||
filename: ${{ steps.publish-prerelease.outputs.FILENAME }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- id: publish-prerelease
|
||||
name: Publish release candidate as prerelease
|
||||
env:
|
||||
SOURCE_BRANCH: ${{ github.head_ref }}
|
||||
TARGET_COMMITISH: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
# find the next rc tag
|
||||
gh api \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/{owner}/{repo}/releases > releases.json
|
||||
# get $TAG from branch name, e.g. v0.25.0
|
||||
TAG=$(echo $SOURCE_BRANCH | sed 's/release\/\(.*\)/\1/')
|
||||
# export $NEXT_TAG using releases.json and $TAG, e.g. v0.25.0-rc.0
|
||||
cd scripts
|
||||
./find-tag.sh
|
||||
# publish the release as prerelease rc
|
||||
gh api \
|
||||
--method POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/{owner}/{repo}/releases \
|
||||
-f tag_name="$NEXT_TAG" \
|
||||
-f target_commitish="$TARGET_COMMITISH" \
|
||||
-f name="$NEXT_TAG" \
|
||||
-F draft=false \
|
||||
-F prerelease=true \
|
||||
-F generate_release_notes=true > release.json
|
||||
# save output for upload
|
||||
echo "FILENAME=xverse-web-extension.$NEXT_TAG.zip" >> $GITHUB_OUTPUT
|
||||
echo "UPLOAD_URL=$(cat release.json | jq -r .upload_url)" >> $GITHUB_OUTPUT
|
||||
- id: update-description
|
||||
name: Update PR description with release notes
|
||||
env:
|
||||
PR_ID: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
# update PR description
|
||||
cat release.json | jq -r .body > body.md
|
||||
echo -e "\n\nRelease candidate: $(cat release.json | jq -r .html_url)" >> body.md
|
||||
echo -e "\nTo publish this rc as latest: Merge Commit this PR" >> body.md
|
||||
gh api \
|
||||
--method PATCH \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/{owner}/{repo}/pulls/$PR_ID \
|
||||
-F 'body=@body.md'
|
||||
build-rc:
|
||||
needs: publish-rc
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
always-auth: true
|
||||
node-version: 18
|
||||
registry-url: https://npm.pkg.github.com
|
||||
scope: '@secretkeylabs'
|
||||
cache: npm
|
||||
- name: Install dependencies
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGE_REGISTRY_TOKEN }}
|
||||
run: npm ci
|
||||
- name: Build & zip
|
||||
env:
|
||||
TRANSAC_API_KEY: ${{ secrets.TRANSAC_API_KEY }}
|
||||
MOON_PAY_API_KEY: ${{ secrets.MOON_PAY_API_KEY }}
|
||||
MIX_PANEL_TOKEN: ${{ secrets.MIX_PANEL_TOKEN }}
|
||||
run: |
|
||||
npm run build
|
||||
zip -rj build.zip ./build
|
||||
- name: Upload release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
UPLOAD_URL: ${{needs.publish-rc.outputs.upload_url}}
|
||||
FILENAME: ${{needs.publish-rc.outputs.filename}}
|
||||
with:
|
||||
upload_url: $UPLOAD_URL
|
||||
asset_path: build.zip
|
||||
asset_name: $FILENAME
|
||||
asset_content_type: application/zip
|
||||
65
.github/workflows/build.yml
vendored
65
.github/workflows/build.yml
vendored
@@ -1,11 +1,16 @@
|
||||
name: Build
|
||||
|
||||
name: Build & Test for feature PR
|
||||
##
|
||||
# This workflow tests, builds, and uploads the extension code for each PR
|
||||
#
|
||||
# It should also keep an updated comment on the PR showing where the upload is
|
||||
#
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
|
||||
branches:
|
||||
- develop
|
||||
jobs:
|
||||
build:
|
||||
if: ${{ !startsWith(github.head_ref, 'release/') }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -13,9 +18,10 @@ jobs:
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
always-auth: true
|
||||
node-version: '18.x'
|
||||
node-version: 18
|
||||
registry-url: https://npm.pkg.github.com
|
||||
scope: '@secretkeylabs'
|
||||
cache: npm
|
||||
- name: Install dependencies
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGE_REGISTRY_TOKEN }}
|
||||
@@ -34,7 +40,7 @@ jobs:
|
||||
- name: Save Filename
|
||||
run: |
|
||||
BRANCH_NAME=$(echo ${{ github.head_ref }} | sed 's/\//-/g')
|
||||
GIT_SHA_SHORT=$(git rev-parse --short ${{ github.sha }})
|
||||
GIT_SHA_SHORT=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})
|
||||
echo "FILENAME=xverse-extension.$BRANCH_NAME.$GIT_SHA_SHORT" >> $GITHUB_ENV
|
||||
- name: Upload Archive
|
||||
uses: actions/upload-artifact@v3
|
||||
@@ -46,8 +52,14 @@ jobs:
|
||||
comment-on-pr:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
steps:
|
||||
- name: Get Artifact URL
|
||||
- uses: actions/checkout@v4
|
||||
- name: Get artifact URL
|
||||
env:
|
||||
OWNER: ${{ github.repository_owner }}
|
||||
REPO: ${{ github.event.repository.name }}
|
||||
@@ -56,33 +68,26 @@ jobs:
|
||||
ARTIFACT_URL="https://github.com/$OWNER/$REPO/actions/runs/$WORKFLOW_ID"
|
||||
echo "ARTIFACT_URL=$ARTIFACT_URL" >> $GITHUB_ENV
|
||||
- name: Delete old bot comments
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_ID: ${{ github.event.pull_request.number }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
curl \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
https://api.github.com/repos/$REPO/issues/$PR_ID/comments \
|
||||
gh api \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/{owner}/{repo}/issues/$PR_ID/comments \
|
||||
| jq ".[] | select(.user.login==\"github-actions[bot]\") | .id" \
|
||||
| xargs -I %q curl \
|
||||
-L \
|
||||
-X DELETE \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token $GITHUB_TOKEN"\
|
||||
https://api.github.com/repos/$REPO/issues/comments/%q
|
||||
| xargs -I %q gh api \
|
||||
--method DELETE \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/{owner}/{repo}/issues/comments/%q
|
||||
- name: Post test package PR comment
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
env:
|
||||
VERSION: ${{ steps.published-version.outputs.version }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_URL: ${{ github.event.pull_request.comments_url }}
|
||||
PR_ID: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
curl \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
$GITHUB_URL \
|
||||
-d "{\"body\":\"> Test with build here: ${{ env.ARTIFACT_URL }}\"}"
|
||||
gh api \
|
||||
--method POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/{owner}/{repo}/issues/$PR_ID/comments \
|
||||
-f body="Test with build here: $ARTIFACT_URL"
|
||||
|
||||
13
.github/workflows/create-release-pr.yml
vendored
13
.github/workflows/create-release-pr.yml
vendored
@@ -1,5 +1,9 @@
|
||||
name: Create release PR
|
||||
|
||||
name: Create release PRs
|
||||
##
|
||||
# This workflow initiates the release process (create release PRs):
|
||||
# - creates a release branch with version bump
|
||||
# - creates a release PR to main & develop
|
||||
#
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
@@ -12,7 +16,6 @@ on:
|
||||
- patch
|
||||
- minor
|
||||
- major
|
||||
|
||||
jobs:
|
||||
create-release-pr:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -21,8 +24,8 @@ jobs:
|
||||
pull-requests: write
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: npm
|
||||
|
||||
98
.github/workflows/release.yml
vendored
98
.github/workflows/release.yml
vendored
@@ -1,50 +1,66 @@
|
||||
name: Release
|
||||
|
||||
name: Publish latest release
|
||||
##
|
||||
# This workflow creates a latest release with the same target_commitish
|
||||
# as the highest rc matching the release PR version
|
||||
#
|
||||
# It should also update the release PR description
|
||||
# It should also attach the highest rc asset to the latest release
|
||||
#
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types:
|
||||
- closed
|
||||
jobs:
|
||||
build:
|
||||
publish-latest:
|
||||
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/')}}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
issues: write
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
always-auth: true
|
||||
node-version: '18.x'
|
||||
registry-url: https://npm.pkg.github.com
|
||||
scope: '@secretkeylabs'
|
||||
- name: Install dependencies
|
||||
- id: create-latest-release
|
||||
name: Create latest release
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGE_REGISTRY_TOKEN }}
|
||||
run: npm ci
|
||||
- name: Test
|
||||
SOURCE_BRANCH: ${{ github.head_ref }}
|
||||
run: |
|
||||
npx eslint .
|
||||
npx tsc --noEmit
|
||||
npm test
|
||||
- name: Build
|
||||
# find the target commitish of the latest release matching our tag
|
||||
TAG=$(echo $SOURCE_BRANCH | sed 's/release\/\(.*\)/\1/')
|
||||
gh api \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/{owner}/{repo}/releases > releases.json
|
||||
TARGET_COMMITISH=$(cat releases.json | jq '.[] | select(.tag_name | match("$TAG")) | .target_commitish' | head -1)
|
||||
# publish the latest release
|
||||
gh api \
|
||||
--method POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/{owner}/{repo}/releases \
|
||||
-f tag_name="$TAG" \
|
||||
-f target_commitish="$TARGET_COMMITISH" \
|
||||
-f name="$TAG" \
|
||||
-F generate_release_notes=true > release.json
|
||||
# TODO attach the rc asset to latest release
|
||||
# save output for upload
|
||||
# echo "FILENAME=xverse-web-extension.$TAG.zip" >> $GITHUB_OUTPUT
|
||||
# echo "UPLOAD_URL=$(cat release.json | jq -r .upload_url)" >> $GITHUB_OUTPUT
|
||||
- id: update-description
|
||||
name: Update PR description with release notes
|
||||
env:
|
||||
TRANSAC_API_KEY: ${{ secrets.TRANSAC_API_KEY }}
|
||||
MOON_PAY_API_KEY: ${{ secrets.MOON_PAY_API_KEY }}
|
||||
MIX_PANEL_TOKEN: ${{ secrets.MIX_PANEL_TOKEN }}
|
||||
run: npm run build --if-present
|
||||
- name: Save Filename
|
||||
id: save-filename
|
||||
PR_ID: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
echo "FILENAME=xverse-extension.$(echo ${{github.ref_name}}| sed 's/\//-/').zip" >> $GITHUB_OUTPUT
|
||||
- name: Create Archive
|
||||
run: |
|
||||
zip -rj build.zip ./build
|
||||
- name: Upload Release Asset
|
||||
if: ${{ github.event.release.upload_url }}
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: build.zip
|
||||
asset_name: ${{ steps.save-filename.outputs.FILENAME }}
|
||||
asset_content_type: application/zip
|
||||
# update PR description
|
||||
cat release.json | jq -r .body > body.md
|
||||
echo -e "\n\nPublished latest release: $(cat release.json | jq -r .html_url)" >> body.md
|
||||
gh api \
|
||||
--method PATCH \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/{owner}/{repo}/pulls/$PR_ID \
|
||||
-F 'body=@body.md'
|
||||
|
||||
33
package-lock.json
generated
33
package-lock.json
generated
@@ -117,7 +117,8 @@
|
||||
"tsc-files": "^1.1.4",
|
||||
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
||||
"type-fest": "^2.19.0",
|
||||
"typescript": "^4.8.2",
|
||||
"typescript": "^5.0.0",
|
||||
"typescript-plugin-styled-components": "^3.0.0",
|
||||
"vitest": "^0.34.6",
|
||||
"webpack": "^5.89.0",
|
||||
"webpack-cli": "^4.0.0",
|
||||
@@ -13268,16 +13269,25 @@
|
||||
"integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g=="
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||
"version": "5.3.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript-plugin-styled-components": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/typescript-plugin-styled-components/-/typescript-plugin-styled-components-3.0.0.tgz",
|
||||
"integrity": "sha512-QWlhTl6NqsFxtJyxn7pJjm3RhgzXSByUftZ3AoQClrMMpa4yAaHuJKTN1gFpH3Ti+Rwm56fNUfG9pXSBU+WW3A==",
|
||||
"dev": true,
|
||||
"peerDependencies": {
|
||||
"typescript": "~4.8 || 5"
|
||||
}
|
||||
},
|
||||
"node_modules/ufo": {
|
||||
@@ -24102,11 +24112,18 @@
|
||||
"integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||
"version": "5.3.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||
"dev": true
|
||||
},
|
||||
"typescript-plugin-styled-components": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/typescript-plugin-styled-components/-/typescript-plugin-styled-components-3.0.0.tgz",
|
||||
"integrity": "sha512-QWlhTl6NqsFxtJyxn7pJjm3RhgzXSByUftZ3AoQClrMMpa4yAaHuJKTN1gFpH3Ti+Rwm56fNUfG9pXSBU+WW3A==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"ufo": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.2.tgz",
|
||||
|
||||
@@ -138,10 +138,11 @@
|
||||
"tsc-files": "^1.1.4",
|
||||
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
||||
"type-fest": "^2.19.0",
|
||||
"typescript": "^4.8.2",
|
||||
"typescript": "^5.0.0",
|
||||
"vitest": "^0.34.6",
|
||||
"webpack": "^5.89.0",
|
||||
"webpack-cli": "^4.0.0",
|
||||
"webpack-dev-server": "^4.11.0"
|
||||
"webpack-dev-server": "^4.11.0",
|
||||
"typescript-plugin-styled-components": "^3.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
1
scripts/.gitignore
vendored
1
scripts/.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
release.json
|
||||
pr-*.json
|
||||
body.md
|
||||
releases.json
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#! /bin/bash
|
||||
|
||||
##
|
||||
# create-release-pr.sh for xverse-web-extension
|
||||
#
|
||||
# NOTE: make sure you git commit your work before running this locally.
|
||||
# Alternatively trigger it from the github action
|
||||
#
|
||||
|
||||
if [[ -z "$BUMP" ]]; then
|
||||
echo "BUMP is required. major|minor|patch"
|
||||
exit 1
|
||||
@@ -23,23 +30,6 @@ git merge origin/main -s ours
|
||||
|
||||
git push --set-upstream origin $BRANCH
|
||||
|
||||
echo -e "\n--- Create draft release for $TAG ---"
|
||||
|
||||
gh api \
|
||||
--method POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/{owner}/{repo}/releases \
|
||||
-f tag_name=$TAG \
|
||||
-f target_commitish="$BRANCH" \
|
||||
-f name=$TAG \
|
||||
-F draft=true \
|
||||
-F prerelease=true \
|
||||
-F generate_release_notes=true > release.json
|
||||
|
||||
cat release.json | jq -r .body > body.md
|
||||
echo -e "\n\nDraft release: $(cat release.json | jq -r .html_url)" >> body.md
|
||||
|
||||
for b in main develop; do
|
||||
echo -e "\n--- Create PR to $b ---"
|
||||
|
||||
@@ -53,17 +43,6 @@ for b in main develop; do
|
||||
-f head="$BRANCH" \
|
||||
-f base="$b" > pr-$b.json
|
||||
|
||||
echo -e "\n--- Update PR to $b with description ---"
|
||||
|
||||
PR_ID=$(cat pr-$b.json | jq -r .number)
|
||||
|
||||
gh api \
|
||||
--method PATCH \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/{owner}/{repo}/pulls/$PR_ID \
|
||||
-F 'body=@body.md'
|
||||
|
||||
# clean up temp files
|
||||
# rm pr-$b.json
|
||||
done
|
||||
|
||||
29
scripts/find-tag.sh
Executable file
29
scripts/find-tag.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#! /bin/bash
|
||||
|
||||
##
|
||||
# find-tag.sh
|
||||
#
|
||||
# a util for looking through a list of github releases and exporting the next tag
|
||||
#
|
||||
if [[ -z "$TAG" ]]; then
|
||||
echo "TAG is required. e.g. v0.26.0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if cat releases.json | jq '.[].tag_name' | grep $TAG; then
|
||||
echo found releases matching $TAG
|
||||
LATEST_TAG=$(cat releases.json | jq '.[].tag_name' | grep $TAG | head -1)
|
||||
LATEST_RC=$(echo $LATEST_TAG | grep rc | sed 's/.*-rc\(.*\)/\1/')
|
||||
if [[ -z "$LATEST_RC" ]]; then
|
||||
echo $TAG was already released
|
||||
exit 1;
|
||||
elif [[ -n "$LATEST_RC" ]]; then
|
||||
NEXT_TAG="$TAG-rc.$($LATEST_RC +1)"
|
||||
fi
|
||||
else
|
||||
echo no releases matching $TAG yet
|
||||
NEXT_TAG="$TAG-rc.0"
|
||||
fi
|
||||
|
||||
echo next tag will be $NEXT_TAG
|
||||
export NEXT_TAG=$NEXT_TAG
|
||||
@@ -9,6 +9,8 @@ const ReactRefreshTypeScript = require('react-refresh-typescript');
|
||||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
||||
const Dotenv = require('dotenv-webpack');
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
const createStyledComponentsTransformer = require('typescript-plugin-styled-components').default;
|
||||
const styledComponentsTransformer = createStyledComponentsTransformer();
|
||||
|
||||
const aliases = {
|
||||
// alias stacks.js packages to their esm (default prefers /dist/polyfill)
|
||||
@@ -68,9 +70,10 @@ var options = {
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
getCustomTransformers: () => ({
|
||||
before: [env.NODE_ENV === 'development' && ReactRefreshTypeScript()].filter(
|
||||
Boolean
|
||||
),
|
||||
before:
|
||||
env.NODE_ENV === 'development'
|
||||
? [ReactRefreshTypeScript(), styledComponentsTransformer]
|
||||
: [],
|
||||
}),
|
||||
transpileOnly: false,
|
||||
},
|
||||
@@ -91,9 +94,11 @@ var options = {
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
plugins: [new TsconfigPathsPlugin({
|
||||
configFile: path.join(__dirname, '../', 'tsconfig.json')
|
||||
})],
|
||||
plugins: [
|
||||
new TsconfigPathsPlugin({
|
||||
configFile: path.join(__dirname, '../', 'tsconfig.json'),
|
||||
}),
|
||||
],
|
||||
extensions: fileExtensions
|
||||
.map((extension) => '.' + extension)
|
||||
.concat(['.js', '.jsx', '.ts', '.tsx', '.css']),
|
||||
@@ -124,7 +129,7 @@ var options = {
|
||||
description: process.env.npm_package_description,
|
||||
version: process.env.npm_package_version,
|
||||
...JSON.parse(content.toString()),
|
||||
})
|
||||
}),
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -139,9 +144,11 @@ var options = {
|
||||
],
|
||||
}),
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [{
|
||||
from: 'node_modules/webextension-polyfill/dist/browser-polyfill.js',
|
||||
}],
|
||||
patterns: [
|
||||
{
|
||||
from: 'node_modules/webextension-polyfill/dist/browser-polyfill.js',
|
||||
},
|
||||
],
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: path.join(SRC_ROOT_PATH, 'pages', 'Options', 'index.html'),
|
||||
@@ -160,7 +167,7 @@ var options = {
|
||||
Buffer: ['buffer', 'Buffer'],
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
VERSION: JSON.stringify(require("../package.json").version),
|
||||
VERSION: JSON.stringify(require('../package.json').version),
|
||||
}),
|
||||
],
|
||||
|
||||
|
||||
Reference in New Issue
Block a user