fix: have theme values (#96) #75
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 & Deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: | |
- main | |
jobs: | |
client-checks: | |
name: Client Checks | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/client | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Clean Up | |
run: rm ../../package.json | |
- name: Cache npm dependencies | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node-client-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-client- | |
- name: Install dependencies | |
run: npm install | |
- name: Check Formatting | |
run: npm run prettier | |
client-docker: | |
name: Client Docker Build | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/client | |
steps: | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: actions/checkout@v3 | |
- name: Clean Up | |
run: rm ../../package.json | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
hicsail/auth-client | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build & Push Docker Build | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./packages/client | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha,scope=client | |
cache-to: type=gha,scope=client,mode=max | |
server-checks: | |
name: Server Checks | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/server | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Clean Up | |
run: rm ../../package.json | |
- name: Cache npm dependencies | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node-server-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-server- | |
- name: Install dependencies | |
run: | | |
npm install | |
npm run prisma:generate | |
- name: Check Formatting | |
run: npm run prettier | |
- name: Check Linting | |
run: npm run lint | |
- name: Tests | |
continue-on-error: true | |
run: npm run test:cov | |
- name: Run Code Coverage Report | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
with: | |
api-token: ${{ secrets.CODACY_API_TOKEN }} | |
coverage-reports: packages/server/coverage/lcov.info | |
server-docker: | |
name: Server Docker Build | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/server | |
steps: | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: actions/checkout@v3 | |
- name: Clean Up | |
run: rm ../../package.json | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
hicsail/auth-server | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build & Push Docker Build | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./packages/server | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha,scope=server | |
cache-to: type=gha,mode=max,scope=server | |
deployment: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | |
needs: [ client-docker, server-docker ] | |
steps: | |
- name: Push to Staging | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
method: "POST" | |
url: ${{ secrets.PORTAINER_WEBHOOK }} | |
preventFailureOnNoResponse: true | |
- name: Push to Production | |
uses: fjogeleit/http-request-action@v1 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
method: "POST" | |
url: ${{ secrets.PORTAINER_WEBHOOK_PRODUCTION }} | |
preventFailureOnNoResponse: true |