fix: fix github alert (#3684)

* fix: fix github alert

* fix: fix branch

* fix: remove react-native-webview
This commit is contained in:
huhuanming
2023-10-23 08:54:35 +08:00
committed by GitHub
parent c0f3e994c2
commit ff2820dc52
20 changed files with 1597 additions and 5 deletions

View File

@@ -98,16 +98,12 @@ module.exports = {
'packages/components/src/Icon/*',
'packages/desktop/public/static/js-sdk/*',
// 临时忽略以下目录的检查,迭代后会逐步开启
'packages/app',
'packages/blockchain-libs',
'packages/kit/src/store',
'packages/desktop',
'packages/core',
'packages/engine',
'packages/ext',
'packages/kit-bg',
'packages/shared',
'packages/web',
'packages/web-embed',
],
env: {
browser: true,

44
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,44 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]:"
labels: bug
assignees: ''
---
**Prerequisites**
Please answer the following questions for yourself before submitting an issue. **YOU MAY DELETE THE PREREQUISITES SECTION.**
- [ ] I checked to make sure that this issue has not already been filed
- [ ] I've asked for help in the [OneKey Discord](https://discord.com/invite/onekey) before filing this issue.
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,25 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[Feature]"
labels: feature request
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Community & Quick support**
- [Community Forum](https://github.com/orgs/OneKeyHQ/discussions). Best for: help with building, discussion about best practices.
- [Discord](https://discord.gg/onekey). Best for: sharing your ideas and hanging out with the community.
**Additional context**
Add any other context or screenshots about the feature request here.

129
.github/workflows/bundlediff-ios.yml vendored Normal file
View File

@@ -0,0 +1,129 @@
name: bundlediff-ios
on:
pull_request:
branches: [onekey]
# Cancel a currently running workflow from the same PR/branch/tag
# when a new workflow is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Build current and upload stats.json
# You may replace this with your own build method. All that
# is required is that the stats.json be an artifact
build-ios-head:
name: 'Build ios head'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.ref}}
- name: Setup Node.js v16
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependency
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=4096'
run: |
yarn
- name: Generate stats.json
env:
NODE_OPTIONS: '--max_old_space_size=4096'
run: yarn stats:ios
- name: Upload stats.json
uses: actions/upload-artifact@v3
with:
name: head-stats
path: ./packages/app/stats.json
# Build base for comparison and upload stats.json
# You may replace this with your own build method. All that
# is required is that the stats.json be an artifact
build-ios-base:
name: 'Build ios base'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- name: Setup Node.js v16
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependency
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=4096'
run: |
yarn
- name: Generate stats.json
env:
NODE_OPTIONS: '--max_old_space_size=4096'
run: yarn stats:ios
- name: Upload stats.json
uses: actions/upload-artifact@v3
with:
name: base-stats
path: ./packages/app/stats.json
# run the action against the stats.json files
compare:
name: 'Compare base & head bundle sizes'
runs-on: ubuntu-latest
needs: [build-ios-base, build-ios-head]
steps:
- uses: actions/download-artifact@v3
- uses: github/webpack-bundlesize-compare-action@v1.7.0
with:
title: 'ios bundle diff'
github-token: ${{ secrets.GITHUB_TOKEN }}
current-stats-json-path: ./head-stats/stats.json
base-stats-json-path: ./base-stats/stats.json

129
.github/workflows/bundlediff-web.yml vendored Normal file
View File

@@ -0,0 +1,129 @@
name: bundlediff-web
on:
pull_request:
branches: [onekey]
# Cancel a currently running workflow from the same PR/branch/tag
# when a new workflow is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Build current and upload stats.json
# You may replace this with your own build method. All that
# is required is that the stats.json be an artifact
build-web-head:
name: 'Build web head'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.ref}}
- name: Setup Node.js v16
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependency
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=4096'
run: |
yarn
- name: Generate stats.json
env:
NODE_OPTIONS: '--max_old_space_size=4096'
run: yarn stats:web
- name: Upload stats.json
uses: actions/upload-artifact@v3
with:
name: head-stats
path: ./packages/web/web-build/stats.json
# Build base for comparison and upload stats.json
# You may replace this with your own build method. All that
# is required is that the stats.json be an artifact
build-web-base:
name: 'Build web base'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- name: Setup Node.js v16
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependency
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=4096'
run: |
yarn
- name: Generate stats.json
env:
NODE_OPTIONS: '--max_old_space_size=4096'
run: yarn stats:web
- name: Upload stats.json
uses: actions/upload-artifact@v3
with:
name: base-stats
path: ./packages/web/web-build/stats.json
# run the action against the stats.json files
compare:
name: 'Compare base & head bundle sizes'
runs-on: ubuntu-latest
needs: [build-web-base, build-web-head]
steps:
- uses: actions/download-artifact@v3
- uses: github/webpack-bundlesize-compare-action@v1.7.0
with:
title: 'web bundle diff'
github-token: ${{ secrets.GITHUB_TOKEN }}
current-stats-json-path: ./head-stats/stats.json
base-stats-json-path: ./base-stats/stats.json

61
.github/workflows/codacy.yml vendored Normal file
View File

@@ -0,0 +1,61 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.
name: Codacy Security Scan
on:
push:
branches: [ "onekey" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "onekey" ]
schedule:
- cron: '36 17 * * 0'
permissions:
contents: read
jobs:
codacy-security-scan:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v3
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
output: results.sarif
format: sarif
# Adjust severity of non-security issues
gh-code-scanning-compat: true
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647
# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif

72
.github/workflows/daily-build.yml vendored Normal file
View File

@@ -0,0 +1,72 @@
name: daily-build
on:
schedule:
- cron: '30 19 * * 0,1,2,3,4,5,6'
workflow_dispatch:
jobs:
get-commit-id:
runs-on: ubuntu-latest
outputs:
current_id: ${{ steps.current_id.outputs.current_id }}
upstream_id: ${{ steps.upstream_id.outputs.upstream_id }}
steps:
- name: Clone Build History Branch
uses: actions/checkout@v3
with:
ref: buildhistory
- name: Get Current Version
id: current_id
run: |
echo "current_id=$(sed -n 1p ./build_version)" >> $GITHUB_OUTPUT
echo "current_id: $(sed -n 1p ./build_version)"
- name: Clone Main Branch
uses: actions/checkout@v3
with:
ref: onekey
path: onekey
- name: Get Upstream Version
id: upstream_id
run: |
cd onekey
echo "upstream_id=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "upstream_id: $(git rev-parse --short HEAD)"
daily-build:
runs-on: ubuntu-latest
needs: get-commit-id
strategy:
matrix:
node-version: [16.x]
steps:
- name: Check condition
run: if [ "${{ github.event_name }}" = "schedule" ] && [ "${{ needs.get-commit-id.outputs.current_id }}" = "${{ needs.get-commit-id.outputs.upstream_id }}" ]; then exit 1; fi
- name: 'Setup ENV'
run: |
DATE=`date "+%Y%m%d"`
run_number=$(($GITHUB_RUN_NUMBER % 100))
run_number=$(printf "%02d" $run_number)
build_number="${DATE}${run_number}"
echo '$build_number='$build_number
echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV
- name: Clone Build History Branch
uses: actions/checkout@v3
with:
ref: buildhistory
- name: Update Build Version
run: |
CURRENT_TIME=$(date '+%Y-%m-%d %H:%M:%S')
echo '${{ needs.get-commit-id.outputs.upstream_id }}' > ./build_version
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "build ${{ needs.get-commit-id.outputs.upstream_id }} in $CURRENT_TIME"
git push --set-upstream origin buildhistory

View File

58
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,58 @@
name: lint
on:
pull_request:
branches:
- onekey
- x
push:
branches:
- onekey
- x
# Cancel a currently running workflow from the same PR/branch/tag
# when a new workflow is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependency
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=4096'
run: |
yarn --mode=skip-build && yarn patch-package
yarn lint

View File

@@ -0,0 +1,103 @@
name: release-android
on:
workflow_run:
workflows:
- daily-build
types:
- completed
workflow_dispatch:
jobs:
release-android:
runs-on: ubuntu-latest
if: ${{ !github.event.workflow_run || (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') }}
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Setup keys secret
run: |
echo ${{ secrets.AUTO_SUBMIT_GOOGLE_PLAY_KEY }} | base64 -d > packages/app/pc-api-8644398719570171123-0-dcae07e2afab.json
rm -rf packages/app/android/app/google-services.json
echo ${{ secrets.GOOGLE_SERVICE_ANDROID }} | base64 -d > packages/app/android/app/google-services.json
- name: Setup Expo
uses: OneKeyHQ/actions/expo-server@main
with:
eas-version: 3.5.x
token: ${{ secrets.EXPO_TOKEN }}
- name: Setup ENV BUILD_NUMBER to 1
if: ${{ !github.event.workflow_run }}
run: |
# Generate build number ------- start
echo "BUILD_NUMBER=1" >> $GITHUB_ENV
# Generate build number ------- end
- name: Setup ENV BUILD_NUMBER by workflow_run
if: ${{ github.event.workflow_run }}
run: |
echo "ActionTriggerBy = ${{ github.event.action }} / ${{ github.event_name }}"
# Generate build number ------- start
DATE=`date "+%Y%m%d"`
run_number=$(($workflow_run_number % 100))
run_number=$(printf "%02d" $run_number)
build_number="${DATE}${run_number}"
echo '$build_number='$build_number
echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV
# Generate build number ------- end
env:
workflow_run_number: ${{ github.event.workflow_run.run_number}}
- name: Dotenv Action
id: dotenv
uses: OneKeyHQ/actions/dotenv-action@main
with:
path: .env.version
- name: Modify build.gradle
uses: OneKeyHQ/actions/build-gradle-edit@main
with:
versionCode: ${{ env.BUILD_NUMBER }}
versionName: ${{ steps.dotenv.outputs.version }}
packageName: 'so.onekey.app.wallet'
android_dir: ./packages/app
- name: Write .env.version
run: |
# pass BUILD_NUMBER as env variable to expo server
echo "BUILD_NUMBER=${{ env.BUILD_NUMBER }}" >> .env.version
- name: Inject Environment Variables
env:
COVALENT_KEY: ${{ secrets.COVALENT_KEY }}
GITHUB_SHA: ${{ github.sha }}
run: |
echo "COVALENT_KEY=${{ env.COVALENT_KEY }}" >> .env.expo
echo "GITHUB_SHA=${{ env.GITHUB_SHA }}" >> .env.expo
- name: Build on EAS And Submit
if: ${{ github.event.workflow_run }}
run: |
cd packages/app
eas build --profile=production --platform android --non-interactive --no-wait --resource-class large
eas build --profile=production-store --platform android --non-interactive --no-wait --resource-class large --auto-submit
eas build --profile=production-huawei --platform android --non-interactive --no-wait --resource-class large
- name: Build on EAS
if: ${{ !github.event.workflow_run }}
run: |
cd packages/app
eas build --profile=production --platform android --non-interactive --no-wait --resource-class large

View File

@@ -0,0 +1,197 @@
name: release-desktop-mas
on:
workflow_run:
workflows:
- daily-build
types:
- completed
workflow_dispatch:
jobs:
release-desktop-mas:
runs-on: macos-latest
strategy:
matrix:
node-version: [16.x]
if: ${{ !github.event.workflow_run || (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
with:
lfs: true
- name: Dotenv Action
id: dotenv
uses: OneKeyHQ/actions/dotenv-action@main
with:
path: .env.version
- name: 'Setup ENV'
run: |
echo "ActionTriggerBy = ${{ github.event.action }} / ${{ github.event_name }}"
# Generate build number ------- start
DATE=`date "+%Y%m%d"`
run_number=$(($workflow_run_number % 100))
run_number=$(printf "%02d" $run_number)
build_number="${DATE}${run_number}"
echo '$build_number='$build_number
echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV
# Generate build number ------- end
github_ref="${github_ref////-}"
github_ref="${github_ref/refs-heads-/}"
github_ref="${github_ref/refs-tags-/}"
echo '$github_ref='$github_ref
echo "GITHUB_TAG=$github_ref" >> $GITHUB_ENV
# echo "::set-env name=GITHUB_TAG::$github_ref"
eval "$(node -e 'const v=require("./packages/desktop/package.json").version; console.log("pkg_version="+v)')"
echo '$pkg_version='$pkg_version
echo "PKG_VERSION=$pkg_version" >> $GITHUB_ENV
artifacts_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
echo "ARTIFACTS_URL=$artifacts_url" >> $GITHUB_ENV
env:
github_ref: ${{ github.ref }}
workflow_run_number: ${{ github.event.workflow_run.run_number}}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Setup keys secret
run: |
rm -rf packages/shared/src/analytics/firebase.web.json
echo ${{ secrets.GOOGLE_SERVICE_WEB }} | base64 -d > packages/shared/src/analytics/firebase.web.json
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dep
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=8192'
run: |
yarn
- name: Install electron-builder v23
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./packages/desktop && yarn add electron-builder@23.6.0
- name: Inject Environment Variables
env:
COVALENT_KEY: ${{ secrets.COVALENT_KEY }}
GITHUB_SHA: ${{ github.sha }}
run: |
echo "COVALENT_KEY=${{ env.COVALENT_KEY }}" >> .env
echo "GITHUB_SHA=${{ env.GITHUB_SHA }}" >> .env
# - name: Setup Code Signing file
# run: |
# echo ${{ secrets.DESKTOP_KEYS_SECRET }} | base64 -d > packages/desktop/sign.p12
- name: Install the Apple certificate and provisioning profile for build mas
env:
MAC_INSTALL_P12_BASE64: ${{secrets.MAC_INSTALL_P12_BASE64}}
MAC_INSTALL_P12_PASSWORD: ${{secrets.MAC_INSTALL_P12_PASSWORD}}
APPLE_DISTRIBUTION_P12_BASE64: ${{secrets.APPLE_DISTRIBUTION_P12_BASE64}}
APPLE_DISTRIBUTION_P12_PASSWORD: ${{secrets.APPLE_DISTRIBUTION_P12_PASSWORD}}
PROVISION_PROFILE_BASE64: ${{secrets.PROVISION_PROFILE_BASE64}}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
MAC_INSTALL_P12_PATH=$RUNNER_TEMP/mac_install_certificate.p12
APPLE_DISTRIBUTION_P12_PATH=$RUNNER_TEMP/apple_distribution_certificate.p12
# APPLE_WWDRCA_PATH=$RUNNER_TEMP/apple_WWDRCAG3.cer
PP_PATH=./packages/desktop/OneKey_Mac_App.provisionprofile
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate from secrets
echo -n "$MAC_INSTALL_P12_BASE64" | base64 --decode > $MAC_INSTALL_P12_PATH
echo -n "$APPLE_DISTRIBUTION_P12_BASE64" | base64 --decode > $APPLE_DISTRIBUTION_P12_PATH
echo -n "$PROVISION_PROFILE_BASE64" | base64 --decode > $PP_PATH
# curl https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer > $APPLE_WWDRCA_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $MAC_INSTALL_P12_PATH -P "$MAC_INSTALL_P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security import $APPLE_DISTRIBUTION_P12_PATH -P "$APPLE_DISTRIBUTION_P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
# security import $APPLE_WWDRCA_PATH -A -t cert -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Build and Sign Static MAS
env:
NODE_OPTIONS: '--max_old_space_size=8192'
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
ASC_PROVIDER: ${{ secrets.ASC_PROVIDER }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: 'cd packages/desktop && yarn build:mas'
- name: Clean up keychain and provisioning profile
if: ${{ always() }}
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/OneKey_Mac_App.provisionprofile
- name: Upload Artifacts mas
uses: actions/upload-artifact@v3
with:
name: onekey-desktop-mas
path: |
./packages/desktop/build-electron/mas-universal/*.pkg
- name: validate mas for Testflight
env:
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
run: |
xcrun altool --validate-app --f ./packages/desktop/build-electron/mas-universal/*.pkg -t macOS -u $APPLEID -p $APPLEIDPASS --show-progress
- name: upload mas for Testflight
env:
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
run: |
xcrun altool --upload-app --f ./packages/desktop/build-electron/mas-universal/*.pkg -t macOS -u $APPLEID -p $APPLEIDPASS --show-progress
- name: 'Notify to Slack'
uses: onekeyhq/actions/notice-slack-app-update@main
with:
web-hook-url: ${{ secrets.SLACK_DEV_WEBHOOK }}
artifact-type: Desktop
artifact-name: OneKey-Desktop-MAS
artifact-bundle-id: 'so.onekey.wallet'
artifact-version-name: '${{ steps.dotenv.outputs.version }}@${{ env.BUILD_NUMBER }}'
artifact-version-code: '${{ env.BUILD_NUMBER }}'
artifact-download-url: '${{ env.ARTIFACTS_URL }}'
change-log: 'Download [Artifacts] at the bottom of page.'
custom-issue-url: ''
custom-message-title: ''
custom-message-payload: ''

View File

@@ -0,0 +1,161 @@
name: release-desktop-winms
on:
workflow_run:
workflows:
- daily-build
types:
- completed
workflow_dispatch:
jobs:
release-desktop-winms:
runs-on: macos-latest
strategy:
matrix:
node-version: [16.x]
if: ${{ !github.event.workflow_run || (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
with:
lfs: true
- name: Dotenv Action
id: dotenv
uses: OneKeyHQ/actions/dotenv-action@main
with:
path: .env.version
- name: 'Setup ENV'
run: |
echo "ActionTriggerBy = ${{ github.event.action }} / ${{ github.event_name }}"
# Generate build number ------- start
DATE=`date "+%Y%m%d"`
run_number=$(($workflow_run_number % 100))
run_number=$(printf "%02d" $run_number)
build_number="${DATE}${run_number}"
echo '$build_number='$build_number
echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV
# Generate build number ------- end
github_ref="${github_ref////-}"
github_ref="${github_ref/refs-heads-/}"
github_ref="${github_ref/refs-tags-/}"
echo '$github_ref='$github_ref
echo "GITHUB_TAG=$github_ref" >> $GITHUB_ENV
# echo "::set-env name=GITHUB_TAG::$github_ref"
eval "$(node -e 'const v=require("./packages/desktop/package.json").version; console.log("pkg_version="+v)')"
echo '$pkg_version='$pkg_version
echo "PKG_VERSION=$pkg_version" >> $GITHUB_ENV
artifacts_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
echo "ARTIFACTS_URL=$artifacts_url" >> $GITHUB_ENV
env:
github_ref: ${{ github.ref }}
workflow_run_number: ${{ github.event.workflow_run.run_number}}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Setup keys secret
run: |
rm -rf packages/shared/src/analytics/firebase.web.json
echo ${{ secrets.GOOGLE_SERVICE_WEB }} | base64 -d > packages/shared/src/analytics/firebase.web.json
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dep
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=8192'
run: |
yarn
- name: Inject Environment Variables
env:
COVALENT_KEY: ${{ secrets.COVALENT_KEY }}
GITHUB_SHA: ${{ github.sha }}
run: |
echo "COVALENT_KEY=${{ env.COVALENT_KEY }}" >> .env
echo "GITHUB_SHA=${{ env.GITHUB_SHA }}" >> .env
- name: Setup Code Signing file
run: |
echo ${{ secrets.DESKTOP_KEYS_SECRET }} | base64 -d > packages/desktop/sign.p12
- name: Publish and Sign Static Windows Installer
if: ${{ (github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/onekey') }}
env:
NODE_OPTIONS: '--max_old_space_size=8192'
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
ASC_PROVIDER: ${{ secrets.ASC_PROVIDER }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: './sign.p12'
run: 'cd packages/desktop && yarn publish:winms'
- name: Build and Sign Static Windows Installer
env:
NODE_OPTIONS: '--max_old_space_size=8192'
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
ASC_PROVIDER: ${{ secrets.ASC_PROVIDER }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: './sign.p12'
run: 'cd packages/desktop && yarn build:winms'
- name: Upload Artifacts Windows
uses: actions/upload-artifact@v3
with:
name: onekey-desktop-windows
path: |
./packages/desktop/build-electron/*.exe
- name: Upload Artifacts Release
uses: actions/upload-artifact@v3
with:
name: release
path: |
./packages/desktop/build-electron/*
!./packages/desktop/build-electron/win-unpacked
!./packages/desktop/build-electron/mac-arm64
!./packages/desktop/build-electron/mac
!./packages/desktop/build-electron/linux-unpacked
!./packages/desktop/build-electron/builder-debug.yml
- name: 'Notify to Slack'
uses: onekeyhq/actions/notice-slack-app-update@main
with:
web-hook-url: ${{ secrets.SLACK_DEV_WEBHOOK }}
artifact-type: Desktop
artifact-name: OneKey-Desktop-Win-Store
artifact-bundle-id: 'so.onekey.wallet.desktop'
artifact-version-name: '${{ steps.dotenv.outputs.version }}@${{ env.BUILD_NUMBER }}'
artifact-version-code: '${{ env.BUILD_NUMBER }}'
artifact-download-url: '${{ env.ARTIFACTS_URL }}'
change-log: 'Download [Artifacts] at the bottom of page.'
custom-issue-url: ''
custom-message-title: ''
custom-message-payload: ''

View File

@@ -0,0 +1,185 @@
name: release-desktop
on:
workflow_run:
workflows:
- daily-build
types:
- completed
workflow_dispatch:
jobs:
release-desktop:
runs-on: macos-latest
strategy:
matrix:
node-version: [16.x]
if: ${{ !github.event.workflow_run || (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
with:
lfs: true
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v2
- name: Dotenv Action
id: dotenv
uses: OneKeyHQ/actions/dotenv-action@main
with:
path: .env.version
- name: 'Setup ENV'
run: |
echo "ActionTriggerBy = ${{ github.event.action }} / ${{ github.event_name }}"
# Generate build number ------- start
DATE=`date "+%Y%m%d"`
run_number=$(($workflow_run_number % 100))
run_number=$(printf "%02d" $run_number)
build_number="${DATE}${run_number}"
echo '$build_number='$build_number
echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV
# Generate build number ------- end
github_ref="${github_ref////-}"
github_ref="${github_ref/refs-heads-/}"
github_ref="${github_ref/refs-tags-/}"
echo '$github_ref='$github_ref
echo "GITHUB_TAG=$github_ref" >> $GITHUB_ENV
# echo "::set-env name=GITHUB_TAG::$github_ref"
eval "$(node -e 'const v=require("./packages/desktop/package.json").version; console.log("pkg_version="+v)')"
echo '$pkg_version='$pkg_version
echo "PKG_VERSION=$pkg_version" >> $GITHUB_ENV
artifacts_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
echo "ARTIFACTS_URL=$artifacts_url" >> $GITHUB_ENV
env:
github_ref: ${{ github.ref }}
workflow_run_number: ${{ github.event.workflow_run.run_number}}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Setup keys secret
run: |
rm -rf packages/shared/src/analytics/firebase.web.json
echo ${{ secrets.GOOGLE_SERVICE_WEB }} | base64 -d > packages/shared/src/analytics/firebase.web.json
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dep
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=8192'
run: |
yarn
- name: Inject Environment Variables
env:
COVALENT_KEY: ${{ secrets.COVALENT_KEY }}
GITHUB_SHA: ${{ github.sha }}
run: |
echo "COVALENT_KEY=${{ env.COVALENT_KEY }}" >> .env
echo "GITHUB_SHA=${{ env.GITHUB_SHA }}" >> .env
- name: Setup Code Signing file
run: |
echo ${{ secrets.DESKTOP_KEYS_SECRET }} | base64 -d > packages/desktop/sign.p12
- name: Publish and Sign Static Linux / Macos / Windows Installer
if: ${{ (github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/onekey') }}
env:
NODE_OPTIONS: '--max_old_space_size=8192'
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
ASC_PROVIDER: ${{ secrets.ASC_PROVIDER }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: './sign.p12'
run: 'cd packages/desktop && yarn publish:all'
- name: Build and Sign Static Linux / Macos / Windows Installer
env:
NODE_OPTIONS: '--max_old_space_size=8192'
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
ASC_PROVIDER: ${{ secrets.ASC_PROVIDER }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: './sign.p12'
run: 'cd packages/desktop && yarn build'
- name: Upload Artifacts Mac
uses: actions/upload-artifact@v3
with:
name: onekey-desktop-mac
path: |
./packages/desktop/build-electron/*.dmg
- name: Upload Artifacts Windows
uses: actions/upload-artifact@v3
with:
name: onekey-desktop-windows
path: |
./packages/desktop/build-electron/*.exe
- name: Upload Artifacts Linux
uses: actions/upload-artifact@v3
with:
name: onekey-desktop-linux
path: |
./packages/desktop/build-electron/*.AppImage
- name: Upload Artifacts Release
uses: actions/upload-artifact@v3
with:
name: release
path: |
./packages/desktop/build-electron/*
!./packages/desktop/build-electron/win-unpacked
!./packages/desktop/build-electron/mac-arm64
!./packages/desktop/build-electron/mac
!./packages/desktop/build-electron/linux-unpacked
!./packages/desktop/build-electron/builder-debug.yml
- name: Upload Artifacts to Snap Linux
if: ${{ github.event.workflow_run }}
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
run: |
snapcraft push ./packages/desktop/build-electron/*.snap --release edge
- name: 'Notify to Slack'
uses: onekeyhq/actions/notice-slack-app-update@main
with:
web-hook-url: ${{ secrets.SLACK_DEV_WEBHOOK }}
artifact-type: Desktop
artifact-name: OneKey-Desktop-RN
artifact-bundle-id: 'so.onekey.wallet.desktop'
artifact-version-name: '${{ steps.dotenv.outputs.version }}@${{ env.BUILD_NUMBER }}'
artifact-version-code: '${{ env.BUILD_NUMBER }}'
artifact-download-url: '${{ env.ARTIFACTS_URL }}'
change-log: 'Download [Artifacts] at the bottom of page.'
custom-issue-url: ''
custom-message-title: ''
custom-message-payload: ''

View File

@@ -0,0 +1,123 @@
name: release-ext
on:
workflow_run:
workflows:
- daily-build
types:
- completed
workflow_dispatch:
jobs:
release-ext:
runs-on: macos-latest
strategy:
matrix:
node-version: [16.x]
if: ${{ !github.event.workflow_run || (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
with:
lfs: true
- name: Dotenv Action
id: dotenv
uses: OneKeyHQ/actions/dotenv-action@main
with:
path: .env.version
- name: 'Setup ENV'
run: |
echo "ActionTriggerBy = ${{ github.event.action }} / ${{ github.event_name }}"
# Generate build number ------- start
DATE=`date "+%Y%m%d"`
run_number=$(($workflow_run_number % 100))
run_number=$(printf "%02d" $run_number)
build_number="${DATE}${run_number}"
echo '$build_number='$build_number
echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV
# Generate build number ------- end
github_ref="${github_ref////-}"
github_ref="${github_ref/refs-heads-/}"
github_ref="${github_ref/refs-tags-/}"
echo '$github_ref='$github_ref
echo "GITHUB_TAG=$github_ref" >> $GITHUB_ENV
# echo "::set-env name=GITHUB_TAG::$github_ref"
eval "$(node -e 'const v=require("./packages/ext/package.json").version; console.log("pkg_version="+v)')"
echo '$pkg_version='$pkg_version
echo "PKG_VERSION=$pkg_version" >> $GITHUB_ENV
artifacts_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
echo "ARTIFACTS_URL=$artifacts_url" >> $GITHUB_ENV
env:
github_ref: ${{ github.ref }}
workflow_run_number: ${{ github.event.workflow_run.run_number}}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dep
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=4096'
run: |
yarn
- name: Inject Environment Variables
env:
COVALENT_KEY: ${{ secrets.COVALENT_KEY }}
GITHUB_SHA: ${{ github.sha }}
run: |
echo "COVALENT_KEY=${{ env.COVALENT_KEY }}" >> .env
echo "GITHUB_SHA=${{ env.GITHUB_SHA }}" >> .env
- name: Build Ext
env:
NODE_OPTIONS: '--max_old_space_size=4096'
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: 'yarn build:ext:v3'
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: onekey-extension-rn
path: |
./packages/ext/build/_dist/*.zip
- name: 'Notify to Slack'
uses: onekeyhq/actions/notice-slack-app-update@main
with:
web-hook-url: ${{ secrets.SLACK_DEV_WEBHOOK }}
artifact-type: Extension
artifact-name: OneKey-Extension-RN
artifact-bundle-id: 'so.onekey.wallet.extension'
artifact-version-name: '${{ steps.dotenv.outputs.version }}@${{ env.BUILD_NUMBER }}'
artifact-version-code: '${{ env.BUILD_NUMBER }}'
artifact-download-url: '${{ env.ARTIFACTS_URL }}'
change-log: 'Download [Artifacts] at the bottom of page.'
custom-issue-url: ''
custom-message-title: ''
custom-message-payload: ''

View File

@@ -0,0 +1,121 @@
name: release-ios
on:
workflow_run:
workflows:
- daily-build
types:
- completed
workflow_dispatch:
jobs:
release-ios:
runs-on: ubuntu-latest
if: ${{ !github.event.workflow_run || (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') }}
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Setup keys secret
run: |
echo ${{ secrets.GOOGLE_SERVICE_IOS }} | base64 -d > packages/app/ios/OneKeyWallet/GoogleService-Info.plist
echo ${{ secrets.ASC_API_KEY }} | base64 -d > packages/app/AscApiKey.p8
- name: Setup Credentials
run: |
mkdir packages/app/ios/certs
echo ${{ secrets.CREDENTIALS_JSON }} | base64 -d > packages/app/credentials.json
echo ${{ secrets.DIST_CERT_P12 }} | base64 -d > packages/app/ios/certs/dist.p12
echo ${{ secrets.ADHOC_PROFILE }} | base64 -d > packages/app/ios/certs/profile.mobileprovision
echo ${{ secrets.ADHOC_SERVICE_EXTENSION_PROFILE }} | base64 -d > packages/app/ios/certs/serviceextension-profile.mobileprovision
- name: Setup Expo
uses: OneKeyHQ/actions/expo-server@main
with:
eas-version: 3.5.x
token: ${{ secrets.EXPO_TOKEN }}
- name: Setup ENV BUILD_NUMBER to 1
if: ${{ !github.event.workflow_run }}
run: |
# Generate build number ------- start
echo "BUILD_NUMBER=1" >> $GITHUB_ENV
# Generate build number ------- end
- name: Setup ENV BUILD_NUMBER by workflow_run
if: ${{ github.event.workflow_run }}
run: |
echo "ActionTriggerBy = ${{ github.event.action }} / ${{ github.event_name }}"
# Generate build number ------- start
DATE=`date "+%Y%m%d"`
run_number=$(($workflow_run_number % 100))
run_number=$(printf "%02d" $run_number)
build_number="${DATE}${run_number}"
echo '$build_number='$build_number
echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV
# Generate build number ------- end
env:
workflow_run_number: ${{ github.event.workflow_run.run_number}}
- name: Dotenv Action
id: dotenv
uses: OneKeyHQ/actions/dotenv-action@main
with:
path: .env.version
- name: Modify OneKeyWallet info.plist
uses: OneKeyHQ/actions/build-plist-edit@main
with:
buildNumber: ${{ env.BUILD_NUMBER }}
versionName: ${{ steps.dotenv.outputs.version }}
projectName: OneKeyWallet
dir: ./packages/app
- name: Modify ServiceExtension info.plist
uses: OneKeyHQ/actions/build-plist-edit@main
with:
buildNumber: ${{ env.BUILD_NUMBER }}
versionName: ${{ steps.dotenv.outputs.version }}
projectName: ServiceExtension
dir: ./packages/app
- name: Write .env.version
run: |
# pass BUILD_NUMBER as env variable to expo server
echo "BUILD_NUMBER=${{ env.BUILD_NUMBER }}" >> .env.version
- name: Inject Environment Variables
env:
COVALENT_KEY: ${{ secrets.COVALENT_KEY }}
GITHUB_SHA: ${{ github.sha }}
run: |
echo "COVALENT_KEY=${{ env.COVALENT_KEY }}" >> .env.expo
echo "GITHUB_SHA=${{ env.GITHUB_SHA }}" >> .env.expo
- name: Build on EAS And Auto Submit
if: ${{ github.event.workflow_run }}
run: |
cd packages/app
# eas build --profile=production --platform ios --non-interactive --no-wait
# replace APP STORE provision
echo ${{ secrets.APPSTORE_PROFILE }} | base64 -d > ./ios/certs/profile.mobileprovision
echo ${{ secrets.APPSTORE_SERVICE_EXTENSION_PROFILE }} | base64 -d > ./ios/certs/serviceextension-profile.mobileprovision
eas build --profile=production-store --platform ios --non-interactive --no-wait --auto-submit
- name: Build on EAS
if: ${{ !github.event.workflow_run }}
run: |
cd packages/app
eas build --profile=production --platform ios --non-interactive --no-wait

View File

@@ -0,0 +1,130 @@
name: release-web
on:
workflow_run:
workflows:
- daily-build
types:
- completed
workflow_dispatch:
jobs:
test-web:
runs-on: ubuntu-latest
env:
HOST_PATH: '${{ github.event.repository.name }}/${{ github.sha }}/'
PUBLIC_URL: 'https://asset.onekey-asset.com/${{ github.event.repository.name }}/${{ github.sha }}/'
TEST_ENDPOINT: app.onekeytest.com
if: ${{ !github.event.workflow_run || (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') }}
steps:
- uses: actions/checkout@v3
- name: Setup Environment
uses: actions/setup-node@v3
with:
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
node-version: '16.x'
- name: Dotenv Action
id: dotenv
uses: OneKeyHQ/actions/dotenv-action@main
with:
path: .env.version
- name: Setup ENV
run: |
echo "ActionTriggerBy = ${{ github.event.action }} / ${{ github.event_name }}"
# Generate build number ------- start
DATE=`date "+%Y%m%d"`
run_number=$(($workflow_run_number % 100))
run_number=$(printf "%02d" $run_number)
build_number="${DATE}${run_number}"
echo '$build_number='$build_number
echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV
# Generate build number ------- end
github_ref="${github_ref////-}"
github_ref="${github_ref/refs-heads-/}"
github_ref="${github_ref/refs-tags-/}"
echo '$github_ref='$github_ref
echo "GITHUB_TAG=$github_ref" >> $GITHUB_ENV
# echo "::set-env name=GITHUB_TAG::$github_ref"
eval "$(node -e 'const v=require("./packages/web/package.json").version; console.log("pkg_version="+v)')"
echo '$pkg_version='$pkg_version
echo "PKG_VERSION=$pkg_version" >> $GITHUB_ENV
artifacts_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
echo "ARTIFACTS_URL=$artifacts_url" >> $GITHUB_ENV
env:
github_ref: ${{ github.ref }}
workflow_run_number: ${{ github.event.workflow_run.run_number}}
- name: Setup keys secret
run: |
rm -rf packages/shared/src/analytics/firebase.web.json
echo ${{ secrets.GOOGLE_SERVICE_WEB }} | base64 -d > packages/shared/src/analytics/firebase.web.json
- name: Install Dependency
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=4096'
run: |
yarn
- name: Inject Environment Variables
env:
COVALENT_KEY: ${{ secrets.COVALENT_KEY }}
GITHUB_SHA: ${{ github.sha }}
run: |
echo "COVALENT_KEY=${{ env.COVALENT_KEY }}" >> .env
echo "GITHUB_SHA=${{ env.GITHUB_SHA }}" >> .env
- name: Build Target
env:
PUBLIC_URL: ${{ env.PUBLIC_URL }}
NODE_OPTIONS: '--max_old_space_size=4096'
run: |
cd packages/web && yarn build && cd ../..
- name: Deploy to CDN
uses: OneKeyHQ/actions/s3-upload@main
with:
aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_bucket: ${{ secrets.AWS_BUCKET }}
source_dir: './packages/web/web-build/'
destination_dir: ${{ env.HOST_PATH }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: app-monorepo-${{ github.sha }}
path: |
./packages/web/web-build/
- name: Deploy Github Pages
uses: OneKeyHQ/actions/gh-pages@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./packages/web/web-build
cname: ${{ env.TEST_ENDPOINT }}
force_orphan: true
- name: 'Notify to Slack'
uses: onekeyhq/actions/notice-slack-app-update@main
with:
web-hook-url: ${{ secrets.SLACK_DEV_WEBHOOK }}
artifact-type: WEB
artifact-name: OneKey-Desktop-WEB
artifact-bundle-id: 'so.onekey.wallet.web'
artifact-version-name: '${{ steps.dotenv.outputs.version }}@${{ env.BUILD_NUMBER }}'
artifact-version-code: '${{ env.BUILD_NUMBER }}'
artifact-download-url: '${{ env.ARTIFACTS_URL }}'
change-log: '👋 Successfully deployed to https://app.onekeytest.com/'
custom-issue-url: ''
custom-message-title: ''
custom-message-payload: ''

View File

58
.github/workflows/unittest.yml vendored Normal file
View File

@@ -0,0 +1,58 @@
name: unittest
on:
pull_request:
branches: [onekey]
# Cancel a currently running workflow from the same PR/branch/tag
# when a new workflow is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
unittest:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@onekeyhq'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependency
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=4096'
run: |
yarn --mode=skip-build && yarn setup:env && yarn patch-package
- name: Run Tests
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: '--max_old_space_size=4096'
run: |
yarn test