chore(repo): fix gitpod commits pls #93
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: Publish | |
concurrency: | |
cancel-in-progress: true | |
group: ${{ github.workflow }}-${{ github.event.pull_request.head.label || github.ref }} | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
jobs: | |
build-lint-test-docker: | |
# Make sure to match this to the version in package.json | |
container: 'cypress/included:12.9.0' | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
# Service containers to run with `container-job` | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: 'postgres:alpine' | |
# Provide the password for postgres | |
env: | |
POSTGRES_USER: prisma_user | |
POSTGRES_PASSWORD: CHANGE_ME_PLEASE_OR_I_WILL_CRY | |
POSTGRES_DB: prisma | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
# redis: | |
# # Docker Hub image | |
# image: redis:alpine | |
# # Set health checks to wait until redis has started | |
# options: >- | |
# --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
# ports: | |
# # Maps port 6379 on service container to the host | |
# - 6379:6379 | |
steps: | |
- name: Check out current repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Restore backend build from cache | |
if: ${{ !github.event.act }} | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ github.workspace }}/backend/dist | |
${{ github.workspace }}/**/tsconfig.tsbuildinfo | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-backend-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('backend/src/**.[jt]s?', 'backend/src/**.json') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-backend-${{ hashFiles('**/pnpm-lock.yaml') }}- | |
# see https://github.com/vercel/next.js/pull/27362 | |
- name: Restore frontend build from cache | |
if: ${{ !github.event.act }} | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ github.workspace }}/frontend/.next/cache | |
${{ github.workspace }}/.cache | |
~/.cache | |
${{ github.workspace }}/**/tsconfig.tsbuildinfo | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-frontend-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('frontend/src/**.[jt]sx?', 'frontend/src/**.json') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-frontend-${{ hashFiles('**/pnpm-lock.yaml') }}- | |
- name: π₯ Monorepo install all deps & pnpm | |
uses: ./.github/actions/pnpm-install | |
# - name: Create and seed test database | |
# working-directory: backend | |
# run: | | |
# pnpm exec prisma db push | |
# pnpm exec prisma db seed | |
# env: | |
# PRISMA_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/auth-backend?schema=public | |
- name: ποΈ Ensure Code is Linted | |
run: | | |
pnpm lint:check | |
- name: π§ Ensure Code is Formatted | |
run: | | |
pnpm format:check | |
- name: π Rename .env.example to .env | |
run: | | |
mv .env.example .env | |
- name: πββοΈ Copy .env to backend | |
run: | | |
cp .env backend/.env | |
- name: π€ Build Project | |
run: | | |
pnpm build | |
# - name: π³ Build Docker Image | |
# run: | | |
# docker compose up --build | |
env: | |
NODE_ENV: production | |
- name: π₯³ Run Tests (project-wide) | |
run: | | |
pnpm test | |
- name: π€ Upload Code coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
if: ${{ !github.event.act }} | |
- uses: actions/upload-artifact@v3 | |
if: ${{ !github.event.act }} | |
with: | |
name: cypress-screenshots | |
path: ./frontend/cypress/screenshots | |
- uses: actions/upload-artifact@v3 | |
if: ${{ !github.event.act }} | |
with: | |
name: cypress-videos | |
path: ./frontend/cypress/videos | |
- uses: actions/upload-artifact@v3 | |
if: ${{ !github.event.act }} | |
with: | |
name: build | |
path: | | |
./frontend/.next | |
./frontend/out | |
./frontend/public | |
- uses: actions/upload-artifact@v3 | |
if: ${{ !github.event.act }} | |
with: | |
name: Backend Build | |
path: ./backend/dist | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: [build-lint-test-docker] | |
if: ${{ !github.event.act }} && github.event_name != 'pull_request' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: π₯ Monorepo install all deps & pnpm | |
uses: ./.github/actions/pnpm-install | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_tag_gpgsign: false | |
git_push_gpgsign: false | |
- name: π Publish to the great interwebs. | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
GIT_AUTHOR_NAME: ${{ steps.import_gpg.outputs.name }} | |
GIT_AUTHOR_EMAIL: ${{ steps.import_gpg.outputs.email }} | |
GIT_COMMITTER_NAME: ${{ steps.import_gpg.outputs.name }} | |
GIT_COMMITTER_EMAIL: ${{ steps.import_gpg.outputs.email }} | |
signingKeyId: ${{ steps.import_gpg.outputs.keyid }} | |
signingKey: ${{ secrets.GPG_PRIVATE_KEY }} | |
signingPassword: ${{ secrets.PASSPHRASE }} | |
GH_URL: 'https://api.github.com/' | |
run: | | |
pnpm semantic-release |