My Workflow
https://github.com/streamlux/pulsebanner
I learned a lot about GitHub Actions creating this workflow, and specifically about how to use the matrix strategy. I've included the section of the workflow that uses the matrix strategy below. This job deploys all 3 apps to the staging environment on CapRover.
deploy_staging:
name: Deploy to Staging
runs-on: ubuntu-latest
needs: [build_next, build_nest, build_remotion]
environment: Staging
concurrency: Staging
env:
CAPROVER_URL: ${{ secrets.CAPROVER_URL }}
NEST_CAPROVER_APP_TOKEN: ${{ secrets.NEST_CAPROVER_APP_TOKEN }}
NEXT_CAPROVER_APP_TOKEN: ${{ secrets.NEXT_CAPROVER_APP_TOKEN }}
REMOTION_CAPROVER_APP_TOKEN: ${{ secrets.REMOTION_CAPROVER_APP_TOKEN }}
strategy:
matrix:
include:
- app: nest # name of the app in Caprover
token-key: NEST_CAPROVER_APP_TOKEN # key used to get CAPROVER_APP_TOKEN from env
image: ${{ needs.build_nest.outputs.image-tag }} # image to deploy
- app: next
token-key: NEXT_CAPROVER_APP_TOKEN
image: ${{ needs.build_next.outputs.image-tag }}
- app: remotion
token-key: REMOTION_CAPROVER_APP_TOKEN
image: ${{ needs.build_remotion.outputs.image-tag }}
steps:
# Install Caprover CLI, which we use to deploy images to Caprover
- name: 'Install caprover-cli'
run: npm install -g caprover
# Deploy each app by iterating over matrix values
- name: 'Deploy ${{ matrix.app }}'
env:
APP_NAME: ${{ matrix.app }}
APP_URL: ${{ env.CAPROVER_URL }}
CAPROVER_APP_TOKEN: ${{ env[matrix.token-key] }}
IMAGE_NAME: ${{ matrix.image }}
run: 'caprover deploy --caproverUrl=$APP_URL --imageName=$IMAGE_NAME --appName=$APP_NAME'
Submission Category:
DIY Deployments
Yaml File or Link to Code
PulseBanner
Getting started
Prerequisites
For Windows, install WSL and install these within WSL https://docs.microsoft.com/en-us/windows/wsl/install
- git https://git-scm.com/downloads
- Node.JS and npm https://nodejs.org/en/download/
- Docker engine https://www.docker.com/get-started
Setup
- Clone repo
- Create .env file in project root and copy paste the contents of
.env.template
in and fill in the values. - Run
docker-compose up -d
to start the development PostgreSQL database + Adminer. - Open adminer to verify the database and adminer started properly. Enter password from .env file. Adminer link
- Run
npm install
to install dependencies. - Run
npx prisma db push
to setup the database with our schema. - Verify by viewing the newly created database 'mydb'. Adminer link
- Run
npx prisma db seed
to insert data into the database that is needed to run the application. (things from Stripe like products/prices) - If you have changes in your prisma design, be sure to run
prisma migrate dev --name <short descriptive name>
before merging * - …
Top comments (0)