Merge pull request #284 from Outblock/pump-version #114
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@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Setup pnpm cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- 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 }}" | |
# 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/ |