Always enable debug #158
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: CI | |
on: | |
push: | |
branches: ['master'] | |
pull_request: | |
branches: ['master'] | |
jobs: | |
setup: | |
name: 'Setup Environment' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Set up Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Cache NPM dependencies | |
uses: actions/cache@v3 | |
id: cache-npm | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
build: | |
name: 'Build' | |
runs-on: ubuntu-latest | |
needs: | |
- setup | |
env: | |
NODE_ENV: production | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Set up Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Restore cache | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
- name: Build | |
run: npm run build | |
lint: | |
name: 'Lint' | |
runs-on: ubuntu-latest | |
needs: | |
- setup | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Set up Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Restore cache | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
- name: Lint | |
run: npm run lint | |
codeql: | |
name: 'Perform CodeQL Analysis' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
with: | |
languages: javascript | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
with: | |
category: "/language:javascript" | |
docker: | |
name: 'Build and push Docker images' | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
env: | |
NODE_ENV: production | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set outputs | |
id: vars | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: | | |
mrbartusek/dokchat:${{ steps.vars.outputs.sha_short}} | |
mrbartusek/dokchat:latest | |
ghcr.io/mrbartusek/dokchat:${{ steps.vars.outputs.sha_short}} | |
ghcr.io/mrbartusek/dokchat:latest | |
electron: | |
name: Publish Electron app | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
needs: | |
- build | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Set up Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Restore cache | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Publish app | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npm run electron:publish |