feat: app #2
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: Build | |
on: | |
push: | |
branches: | |
- "trunk" | |
workflow_dispatch: | |
env: | |
NODEJS_VERSION: 18.16.1 | |
IMAGE_NAME: ghcr.io/misfits-labs/wega-platform | |
REGISTRY: ghcr.io | |
jobs: | |
# NOTE: Each job runs in its own VM | |
job_build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
environment: qa | |
steps: | |
- uses: actions/checkout@v3 | |
# NOTE: Checkout action shall change working dir | |
- name: Versioning | |
env: | |
REF: ${{github.ref}} | |
GSAP_TOKEN: ${{github.GSAP_TOKEN}} | |
VITE_RPC_PROVIDER_ALCHEMY: ${{ github.VITE_RPC_PROVIDER_ALCHEMY }} | |
VITE_WALLET_CONNECT_ID: ${{ github.VITE_WALLET_CONNECT_ID }} | |
VITE_FIREBASE_API_KEY: ${{ github.VITE_FIREBASE_API_KEY }} | |
VITE_FIREBASE_AUTH_DOMAIN: ${{ github.VITE_FIREBASE_AUTH_DOMAIN }} | |
VITE_FIREBASE_DB_URL: ${{ github.VITE_FIREBASE_DB_URL }} | |
VITE_FIREBASE_PROJECT_ID: ${{ github.VITE_FIREBASE_PROJECT_ID }} | |
VITE_FIREBASE_STORAGE_BUCKET: ${{ github.VITE_FIREBASE_STORAGE_BUCKET }} | |
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ github.VITE_FIREBASE_MESSAGING_SENDER_ID }} | |
VITE_FIREBASE_APP_ID: ${{ github.VITE_FIREBASE_APP_ID }} | |
run: | | |
echo "REF=$REF" | |
echo "REF=$REF" >> $GITHUB_ENV | |
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -7) | |
echo "SHORT_COMMIT=$SHORT_COMMIT" | |
echo "SHORT_COMMIT=$SHORT_COMMIT" >> $GITHUB_ENV | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{env.NODEJS_VERSION}} | |
cache: 'npm' | |
env: | |
GSAP_TOKEN: ${{secrets.GSAP_TOKEN}} | |
- name: Install dependencies | |
env: | |
GSAP_TOKEN: ${{secrets.GSAP_TOKEN}} | |
run: | | |
npm install --frozen-lockfile | |
# Due to front-end nature of environment config, need specific image for each environment | |
- name: Build image qa | |
env: | |
GSAP_TOKEN: ${{secrets.GSAP_TOKEN}} | |
NPM_TOKEN: ${{secrets.NPM_TOKEN}} | |
VITE_RPC_PROVIDER_ALCHEMY: ${{secrets.VITE_RPC_PROVIDER_ALCHEMY}} | |
VITE_WALLET_CONNECT_ID: ${{secrets.VITE_WALLET_CONNECT_ID}} | |
VITE_BACKEND_API_URL: ${{ vars.VITE_BACKEND_API_URL }} | |
VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }} | |
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }} | |
VITE_FIREBASE_DB_URL: ${{ secrets.VITE_FIREBASE_DB_URL }} | |
VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }} | |
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }} | |
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }} | |
VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }} | |
run: | | |
# cp .env.qa .env | |
# TODO Temporary disable CI to test deployment | |
CI=false yarn build | |
QA_TAG=${SHORT_COMMIT}-qa | |
echo "QA_TAG=$QA_TAG" | |
echo "QA_TAG=$QA_TAG" >> $GITHUB_ENV | |
echo "docker build -t $IMAGE_NAME:$QA_TAG ." | |
docker build -t $IMAGE_NAME:$QA_TAG . | |
- name: Docker login | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push image qa | |
run: | | |
echo "docker push $IMAGE_NAME:$QA_TAG" | |
docker push $IMAGE_NAME:$QA_TAG | |
# TODO Build stg | |
# TODO Build prod | |