Skip to content

Merge pull request #452 from owallet-io/feat/update-yarn #429

Merge pull request #452 from owallet-io/feat/update-yarn

Merge pull request #452 from owallet-io/feat/update-yarn #429

name: Extension release workflow
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest #orai-self-hosted
strategy:
matrix:
node-version: [18.17.0]
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.8.0
with:
access_token: ${{ github.token }}
- name: Checkout to Project
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Checkout Repository with Submodules
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
ssh-key: ${{ secrets.SSH_DEPLOY_KEY_MAIN }}
- name: Update Git Submodules
run: git submodule update --remote --merge
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
.yarn/cache
.yarn/install-state.gz
!.eslintcache # Exclude eslint cache
key: ${{ runner.os }}-yarn-${{ github.sha }} # Cache per commit
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
yarn install
- name: Install extension packages
working-directory: apps/extension
run: yarn --silent
- name: Build Libs
run: yarn build:libs
# - name: Build Stores Internal
# run: yarn build:stores-internal
# - name: Build Hooks Internal
# run: yarn build:hooks-internal
- name: Build extension
working-directory: apps/extension
run: yarn build
env:
REACT_APP_MIX_PANEL_TOKEN: ${{ secrets.MIX_PANEL_TOKEN }}
- name: Publish extension for test
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
REF_NAME: ${{ github.ref_name }}
run: |
chmod 777 -R ./scripts
./scripts/release.sh
- name: Upload & release
uses: mnao305/chrome-extension-upload@v4.0.1
if: ${{ (env.PRERELEASE == '') }}
with:
file-path: apps/extension/owallet-extension-${{ github.ref_name }}.zip
extension-id: ${{ secrets.EXT_ID }}
client-id: ${{ secrets.EXT_CLIENT_ID }}
client-secret: ${{ secrets.EXT_CLIENT_SECRET }}
refresh-token: ${{ secrets.EXT_REFRESH_TOKEN }}
publish: false
- name: Send discord message
uses: appleboy/discord-action@master
with:
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
username: "GitBot"
message: Extension released successfully! head_commit=${{ github.event.head_commit.message }}
- name: Send discord message
if: ${{ failure() }}
uses: appleboy/discord-action@master
with:
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
username: "GitBot"
message: Extension released fail! ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}