diff --git a/.github/workflows/monitor.yml b/.github/workflows/monitor.yml new file mode 100644 index 000000000..377b2d942 --- /dev/null +++ b/.github/workflows/monitor.yml @@ -0,0 +1,38 @@ +name: Monitorar Aplicação + +on: + schedule: + - cron: "*/5 * * * *" # roda a cada 5 minutos + workflow_dispatch: # permite rodar manualmente também + +jobs: + monitor: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Criar arquivo de log se não existir + run: | + if [ ! -f monitor.log ]; then + echo "Arquivo de log criado em $(date)" > monitor.log + fi + + - name: Monitorar aplicação + run: | + URL="https://spliit-ivory.vercel.app" + TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S") + STATUS=$(curl -s -o /dev/null -w "%{http_code}" $URL) + + if [ "$STATUS" == "200" ]; then + echo "$TIMESTAMP - OK (200)" >> monitor.log + else + echo "$TIMESTAMP - ERRO (Status: $STATUS)" >> monitor.log + fi + + - name: Salvar log como artefato + uses: actions/upload-artifact@v4 + with: + name: monitor-log + path: monitor.log diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 000000000..0eb564ffa --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,21 @@ +name: Scan SonarCloud + +on: + push: + branches: + - imsi_action + pull_request: + types: [opened, synchronize, reopened] + +jobs: + sonarqube: + name: SonarQube + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v6 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/vercel-deploy.yml b/.github/workflows/vercel-deploy.yml new file mode 100644 index 000000000..12f71df43 --- /dev/null +++ b/.github/workflows/vercel-deploy.yml @@ -0,0 +1,34 @@ +name: Deploy no Vercel + +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + +on: + push: + branches: + - imsi_action + +jobs: + Deploy-Production: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install Vercel CLI + run: npm install -g vercel@latest + + - name: Pull Vercel Environment + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + + - name: Build Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + + - name: Deploy + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} diff --git a/README.md b/README.md index 91ee5d155..3a0bdbeaa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [Spliit](https://spliit.app) -Spliit is a free and open source alternative to Splitwise. You can either use the official instance at [Spliit.app](https://spliit.app), or deploy your own instance: +Spliit is a free and open source alternative to Splitwise. You can either use the official instance at [Spliit.app](https://spliit-git-imsi-action-gabrielrds-projects.vercel.app/), or deploy your own instance: [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fspliit-app%2Fspliit&project-name=my-spliit-instance&repository-name=my-spliit-instance&stores=%5B%7B%22type%22%3A%22postgres%22%7D%5D&) diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..621f35b40 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,12 @@ +sonar.projectKey=gabrielrddev_spliit +sonar.organization=gabrielrddev + +# Caminho do código fonte +sonar.sources=src + +# Arquivos a excluir +sonar.exclusions=**/node_modules/**,**/dist/**,**/coverage/**,**/public/** + +# Encoding of the source code. Default is default system encoding +sonar.sourceEncoding=UTF-8 +sonar.typescript.tsconfigPath=tsconfig.json