feat: test ci #1950
This file contains 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-web | |
on: | |
pull_request: | |
branches: | |
- feat/prime-login0-limi | |
push: | |
branches: | |
- feat/prime-login0-limi | |
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: | |
- name: Checkout Source Code | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Run Shared Env Setup | |
uses: ./.github/actions/shared-env | |
with: | |
env_file_name: '.env' | |
sentry_project: 'web' | |
covalent_key: ${{ secrets.COVALENT_KEY }} | |
sentry_token: ${{ secrets.SENTRY_TOKEN }} | |
privy_app_id: ${{ secrets.PRIVY_APP_ID }} | |
privy_mobile_client_id: ${{ secrets.PRIVY_MOBILE_CLIENT_ID }} | |
revenuecat_api_key_web: ${{ secrets.REVENUECAT_API_KEY_WEB }} | |
revenuecat_api_key_web_sandbox: ${{ secrets.REVENUECAT_API_KEY_WEB_SANDBOX }} | |
revenuecat_api_key_apple: ${{ secrets.REVENUECAT_API_KEY_APPLE }} | |
revenuecat_api_key_google: ${{ secrets.REVENUECAT_API_KEY_GOOGLE }} | |
- name: Setup Environment | |
uses: actions/setup-node@v3 | |
with: | |
registry-url: 'https://npm.pkg.github.com' | |
always-auth: true | |
scope: '@onekeyhq' | |
node-version: '20.x' | |
- name: Setup ENV | |
run: | | |
eval "$(node -e 'const v=require("./apps/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: Install Dependency | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_OPTIONS: '--max_old_space_size=4096' | |
run: | | |
yarn | |
- name: Build Target | |
env: | |
PUBLIC_URL: ${{ env.PUBLIC_URL }} | |
NODE_OPTIONS: '--max_old_space_size=4096' | |
run: | | |
yarn app:web:build | |
- 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: './apps/web/web-build/' | |
destination_dir: ${{ env.HOST_PATH }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app-monorepo-${{ github.sha }} | |
path: | | |
./apps/web/web-build/ | |
- name: Deploy Github Pages | |
uses: OneKeyHQ/actions/gh-pages@main | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./apps/web/web-build | |
cname: ${{ env.TEST_ENDPOINT }} | |
force_orphan: true | |
# - name: 'Notify to Slack' | |
# if: ${{ github.event.workflow_run }} | |
# uses: onekeyhq/actions/slack-notify-webhook@main | |
# with: | |
# web-hook-url: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }} | |
# secret-key: ${{ secrets.ACTION_SIGN_SECERT_KEY }} | |
# artifact-type: Web | |
# artifact-name: OneKey-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 }}' |