diff --git a/.github/workflows/full-workflow.yml b/.github/workflows/full-workflow.yml index 2c4fc85..ace4c6b 100644 --- a/.github/workflows/full-workflow.yml +++ b/.github/workflows/full-workflow.yml @@ -3,7 +3,15 @@ name: Complete workflow -on: ['push', 'pull_request'] +on: + push: + branches: + - main + - master + pull_request: + branches: + - main + - master jobs: @@ -18,7 +26,6 @@ jobs: steps: - uses: actions/checkout@v2 - - run: git fetch --prune --unshallow - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 @@ -36,15 +43,11 @@ jobs: - name: Run all tests run: yarn test - - shell: bash - if: github.ref == 'refs/heads/master' - name: Create SSH deployment key - env: - SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }} - run: ./scripts/deploy.sh - - - name: Deployment - if: github.ref == 'refs/heads/master' - run: git remote add umbler ssh://git@geonosis.deploy.umbler.com:9922/jy4xooxj/waldemarnt2-com.git && git push umbler master - env: - CI: true + - name: Deploy application + if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }} + uses: akhileshns/heroku-deploy@v3.12.12 + with: + heroku_api_key: ${{secrets.HEROKU_API_KEY}} + heroku_app_name: "peaceful-plateau-04699" + heroku_email: "waldemarnt@gmail.com" + buildpack: "https://github.com/zidizei/heroku-buildpack-tsc#v2.0" diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json index 709f659..d22c0ba 100644 --- a/config/custom-environment-variables.json +++ b/config/custom-environment-variables.json @@ -1,6 +1,6 @@ { "App": { - "port": "APP_PORT", + "port": "PORT", "database": { "mongoUrl": "MONGODB_URL" }, diff --git a/package.json b/package.json index 12441fe..c775885 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "build": "tsc", - "start": "yarn build && node dist/src/index.js", + "start": "node dist/src/index.js", "start:local": "dotenv -e .env -- ts-node-dev --transpile-only src/index.ts | pino-pretty -c", "test": "yarn lint && yarn style:check && yarn test:unit && yarn test:functional", "lint": "eslint ./src ./test --ext .ts", @@ -15,7 +15,8 @@ "style:check": "prettier --check 'src/**/*.ts' 'test/**/*.ts'", "style:fix": "prettier --write 'src/**/*.ts' 'test/**/*.ts'" }, - "engines": { "node": ">=14" }, + "postinstall": "yarn build", + "engines": { "node": "12" }, "repository": { "type": "git", "url": "git+https://github.com/waldemarnt/node-typescript-api.git" diff --git a/scripts/deploy.sh b/scripts/deploy.sh deleted file mode 100755 index 5f90b72..0000000 --- a/scripts/deploy.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# Init .ssh dir and expand $SSH_KEY -mkdir -p ~/.ssh -echo -e "${SSH_KEY//_/\\n}" > ~/.ssh/id_rsa -chmod 600 ~/.ssh/id_rsa - -# Add umbler's git to the list of known_hosts to prevent terminal for asking to confirm the host -ssh-keyscan -p 9922 -t rsa geonosis.deploy.umbler.com 2>&1 >> ~/.ssh/known_hosts