diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..0b9d4a6 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,43 @@ +name: Docker Image CI + +on: + push: + branches: + - master + release: + types: + - published + +jobs: + build: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ohmyform/api + tags: | + type=raw,value=latest + type=semver,pattern={{major}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{version}} + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..df272da --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Lint + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + run-linters: + name: Run linters + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: 16 + + # ESLint and Prettier must be in `package.json` + - name: Install Node.js dependencies + run: yarn install --frozen-lockfile --silent + + - name: Lint + uses: reviewdog/action-eslint@v1 + with: + reporter: github-pr-review # Change reporter. + eslint_flags: '{src,test}/**/*.ts' + + - name: Typecheck + uses: andoshin11/typescript-error-reporter-action@v1.0.2 + diff --git a/package.json b/package.json index 8ee92ab..9fb4e7a 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "start:dev": "nest start --watch", "start:debug": "nest start --debug --watch", "start:prod": "cross-env NODE_ENV=production node dist/main", - "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", + "lint": "eslint \"{src,test}/**/*.ts\" --fix", "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage",