Skip to content

Commit

Permalink
Merge pull request #817 from secretkeylabs/chore/merge-main-to-public…
Browse files Browse the repository at this point in the history
…-1712732445

merge-main-to-public
  • Loading branch information
teebszet committed Apr 10, 2024
2 parents c4c3688 + eaf04d9 commit e626ac9
Show file tree
Hide file tree
Showing 25 changed files with 907 additions and 273 deletions.
14 changes: 11 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"airbnb-typescript",
"airbnb/hooks",
"prettier",
"plugin:@tanstack/eslint-plugin-query/recommended"
"plugin:@tanstack/eslint-plugin-query/recommended",
"plugin:playwright/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand All @@ -20,10 +21,17 @@
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["react", "prettier", "eslint-plugin-no-inline-styles", "@tanstack/query"],
"ignorePatterns": ["tests/**/*", "playwright.config.ts"],
"plugins": [
"react",
"prettier",
"eslint-plugin-no-inline-styles",
"@tanstack/query",
"eslint-plugin-playwright"
],
"rules": {
"consistent-return": "off",
"no-await-in-loop": "off",
"playwright/valid-title": "off",
"import/prefer-default-export": 1,
"no-restricted-imports": [
"warn",
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @secretkeylabs/reviewers-web-extension
34 changes: 34 additions & 0 deletions .github/workflows/merge-repos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Merge branch to remote

on:
workflow_dispatch:
inputs:
branch:
description: 'Merge branch'
required: true
default: develop
type: choice
options:
- develop
- main

jobs:
merge-branch-to-remote:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
- id: run-merge-script
env:
ORIGIN_BRANCH: ${{ inputs.branch }}
REMOTE_REPO: ${{ secrets.REMOTE_REPO }}
GH_TOKEN: ${{ secrets.GH_REPOS_RW_PAT }}
run: |
# git config
git config user.name "GitHub Actions Bot"
git config user.email "<>"
# run shell script
cd scripts
ORIGIN_BRANCH=$ORIGIN_BRANCH REMOTE_REPO=$REMOTE_REPO ./merge-to-remote.sh
62 changes: 31 additions & 31 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@ jobs:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
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
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: Install Playwright Browsers
run: npx playwright install chromium --with-deps
- name: Run UI test suite
run: xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" npx playwright test --reporter=html
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: playwright-report/
retention-days: 30

- uses: actions/checkout@v4
- name: Use Node.js
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
env:
TRANSAC_API_KEY: ${{ secrets.TRANSAC_API_KEY }}
MOON_PAY_API_KEY: ${{ secrets.MOON_PAY_API_KEY }}
MIX_PANEL_TOKEN: ${{ secrets.MIX_PANEL_TOKEN }}
MIX_PANEL_EXPLORE_APP_TOKEN: ${{ secrets.MIX_PANEL_EXPLORE_APP_TOKEN }}
run: npm run build --if-present
- name: Install Playwright Browsers
run: npx playwright install chromium --with-deps
- name: Run UI test suite
run: xvfb-run --auto-servernum --server-args="-screen 0 360x360x24" npx playwright test --reporter=html
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: playwright-report/
retention-days: 30
33 changes: 33 additions & 0 deletions .github/workflows/release-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Merge release to develop
##
# This workflow triggers on merge of release branch back to develop
#
# It should push to public repo
#
on:
pull_request:
branches:
- develop
types:
- closed
jobs:
publish-latest:
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/')}}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- id: push-to-public
name: Push to public remote
if: ${{ contains(github.repositoryUrl, 'private') }}
run: |
# git config
git config user.name "GitHub Actions Bot"
git config user.email "<>"
# run shell script
cd scripts
ORIGIN_BRANCH=develop REMOTE_REPO=xverse-web-extension ./merge-to-remote.sh
46 changes: 44 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
env:
SOURCE_BRANCH: ${{ github.head_ref }}
run: |
cd scripts
# find the target commitish of the latest release matching our tag
TAG=$(echo $SOURCE_BRANCH | sed 's/release\/\(.*\)/\1/')
gh api \
Expand All @@ -48,6 +49,8 @@ jobs:
-f name="$TAG" \
-F generate_release_notes=true > release.json
# save env for upload
echo "TAG=$TAG" >> $GITHUB_ENV
echo "TARGET_COMMITISH=$TARGET_COMMITISH" >> $GITHUB_ENV
echo "TAG_RC=$TAG_RC" >> $GITHUB_ENV
echo "FILENAME=xverse-web-extension.$TAG.zip" >> $GITHUB_ENV
echo "UPLOAD_URL=$(cat release.json | jq -r .upload_url)" >> $GITHUB_ENV
Expand All @@ -68,11 +71,11 @@ jobs:
- id: download-latest-asset
name: Download latest asset from rc
run: |
RELEASE_ID=$(cat releases.json | jq -r ".[] | select(.tag_name==\"$TAG_RC\") | .id")
ASSET_ID=$(cat releases.json | jq -r ".[] | select(.tag_name==\"$TAG_RC\") | .assets[0].id")
gh api \
-H "Accept: application/octet-stream" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/{owner}/{repo}/releases/assets/$RELEASE_ID > build.zip
/repos/{owner}/{repo}/releases/assets/$ASSET_ID > build.zip
- id: upload-latest-asset
name: Upload latest asset to latest release
uses: actions/upload-release-asset@v1
Expand All @@ -83,3 +86,42 @@ jobs:
asset_path: build.zip
asset_name: ${{ env.FILENAME }}
asset_content_type: application/zip
- id: push-to-public
name: Push to public remote
if: ${{ contains(github.repositoryUrl, 'private') }}
env:
REMOTE_REPO: xverse-web-extension
run: |
# git config
git config user.name "GitHub Actions Bot"
git config user.email "<>"
# run shell script
./merge-to-remote.sh
- id: copy-release-to-public
name: Copy release to public remote
needs: push-to-public
env:
REMOTE_REPO: xverse-web-extension
run: |
# publish the latest release on remote
cat release.json | jq -r .body > public-body.md
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/{owner}/$REMOTE_REPO/releases \
-f tag_name="$TAG" \
-f target_commitish="$TARGET_COMMITISH" \
-f name="$TAG" \
-F 'body=@public-body.md' > public-release.json
echo "PUBLIC_UPLOAD_URL=$(cat public-release.json | jq -r .upload_url)" >> $GITHUB_ENV
- id: upload-latest-asset-to-public
name: Upload latest asset to latest release on public remote
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.PUBLIC_UPLOAD_URL}}
asset_path: build.zip
asset_name: ${{ env.FILENAME }}
asset_content_type: application/zip
Loading

0 comments on commit e626ac9

Please sign in to comment.