diff --git a/.github/workflows/Deploy Preview.yml b/.github/workflows/Deploy Preview.yml index b11ee1f..e93d524 100644 --- a/.github/workflows/Deploy Preview.yml +++ b/.github/workflows/Deploy Preview.yml @@ -6,7 +6,7 @@ on: - main jobs: - build: + build-and-deploy: runs-on: ubuntu-latest steps: @@ -16,7 +16,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: '18.17.0' + node-version: '18.17.0' - name: Install dependencies run: npm install @@ -25,10 +25,27 @@ jobs: run: npm run build - name: Deploy to Vercel - uses: amondnet/vercel-action@v20 + env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + run: | + DEPLOY_URL=$(npx vercel --prod --token $VERCEL_TOKEN --confirm | tail -n 1) + echo "Vercel Deployment URL: $DEPLOY_URL" + echo "DEPLOY_URL=$DEPLOY_URL" >> $GITHUB_ENV + id: vercel-deploy + + - name: Comment on Pull Request + uses: actions/github-script@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - vercel-token: ${{ secrets.VERCEL_TOKEN }} - vercel-args: '--prod' - working-directory: ./ - github-token: ${{ secrets.GITHUB_TOKEN }} - scope: ruslanlukoanov0-gmailcom + script: | + const { DEPLOY_URL } = process.env; + const issue_number = context.payload.pull_request.number; + await github.rest.issues.createComment({ + issue_number: issue_number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `Deployed to Vercel: ${DEPLOY_URL}` + }); diff --git a/package.json b/package.json index 53cffb3..4cf09eb 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "eslint . --ext .ts,.tsx,.jsx", + "lint": "eslint . --ext .ts,.tsx,.jsx --max-warnings=0", "prepare": "husky", "commitlint": "commitlint --edit" }, diff --git a/src/app/page.tsx b/src/app/page.tsx index 0353dda..8a1383a 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,3 +1,4 @@ +/* eslint-disable max-len */ import Image from 'next/image'; import styles from './page.module.css'; diff --git a/src/components/test.tsx b/src/components/test.tsx new file mode 100644 index 0000000..8a6140c --- /dev/null +++ b/src/components/test.tsx @@ -0,0 +1,9 @@ +import React from 'react'; + +interface Props { + className?: string; +} + +export const Test: React.FC = ({ className }) => { + return
; +};