Skip to content

release-ext

release-ext #1534

Workflow file for this run

name: release-ext
on:
workflow_run:
workflows:
- daily-build
types:
- completed
workflow_dispatch:
jobs:
release-ext:
runs-on: macos-latest
strategy:
matrix:
node-version: [20.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("./apps/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 app:ext:build:all'
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: onekey-extension-rn
path: |
./apps/ext/build/_dist/*.zip
- 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: 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 }}'