Merge pull request #311 from Outblock:310-feature-ts-webpack-and-build #175
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: Production Build | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, ready_for_review] | |
push: | |
branches: [dev, master] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: production | |
strategy: | |
matrix: | |
node-version: [22.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run tests | |
run: pnpm test | |
- name: Create .env.pro file | |
run: | | |
cat << EOF > .env.pro | |
# Git info | |
COMMIT_SHA="${{ github.sha }}" | |
BRANCH_NAME="${{ github.ref_name }}" | |
PR_TITLE="${{ github.event.pull_request.title || '' }}" | |
PR_NUMBER="${{ github.event.pull_request.number || '' }}" | |
# Google drive | |
GD_BACKUP_NAME="${{ vars.GD_BACKUP_NAME }}" | |
GD_FOLDER="${{ vars.GD_FOLDER }}" | |
GD_AES_KEY="${{ secrets.GD_AES_KEY }}" | |
GD_IV="${{ secrets.GD_IV }}" | |
GOOGLE_API="${{ secrets.GOOGLE_API }}" | |
FB_TOKEN="${{ secrets.FB_TOKEN }}" | |
# firebase | |
FB_API_KEY="${{ secrets.FB_API_KEY }}" | |
FB_AUTH_DOMAIN="${{ secrets.FB_AUTH_DOMAIN }}" | |
FB_DATABASE_URL="${{ secrets.FB_DATABASE_URL }}" | |
FB_PROJECTID="${{ secrets.FB_PROJECTID }}" | |
FB_STORAGE_BUCKET="${{ secrets.FB_STORAGE_BUCKET }}" | |
FB_MESSAGING_SENDER_ID="${{ secrets.FB_MESSAGING_SENDER_ID }}" | |
FB_APP_ID="${{ secrets.FB_APP_ID }}" | |
FB_MEASUREMENT_ID="${{ secrets.FB_MEASUREMENT_ID }}" | |
FB_FUNCTIONS="${{ secrets.FB_FUNCTIONS }}" | |
API_NEWS_PATH="${{ vars.API_NEWS_PATH }}" | |
API_CONFIG_PATH="${{ vars.API_CONFIG_PATH }}" | |
API_BASE_URL="${{ vars.API_BASE_URL }}" | |
# manifest | |
OAUTH2_CLIENT_ID="${{ secrets.OAUTH2_CLIENT_ID }}" | |
OAUTH2_SCOPES="${{ vars.OAUTH2_SCOPES }}" | |
WC_PROJECTID="${{ secrets.WC_PROJECTID }}" | |
MIXPANEL_TOKEN="${{ secrets.MIXPANEL_TOKEN }}" | |
EOF | |
- name: Build production | |
run: pnpm run build:ci | |
env: | |
CI: true | |
COMMIT_SHA: ${{ github.sha }} | |
BRANCH_NAME: ${{ github.ref_name }} | |
PR_TITLE: ${{ github.event.pull_request.title || '' }} | |
PR_NUMBER: ${{ github.event.pull_request.number || '' }} | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: extension-build | |
path: dist/ | |
- name: Check build size | |
run: | | |
echo "Build size:" | |
du -sh dist/ |