diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 60e2015..44f660d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,17 +1,34 @@ -name: Deploy +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs +name: deploy -# run after validate workflow has completed and the current branch is 'beta' on: - workflow_run: - workflows: ['validate'] - types: [completed] - branches: - - 'main' + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] jobs: + validate: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x, 21.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + deploy: - name: deploy + needs: validate runs-on: ubuntu-latest steps: - name: executing remote ssh commands using password @@ -22,3 +39,4 @@ jobs: password: ${{ secrets.PASSWORD }} port: ${{ secrets.PORT }} script: cd /home/nessar/portfolio/ ; ./installRelease.sh + diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml deleted file mode 100644 index 5dc2960..0000000 --- a/.github/workflows/validate.yml +++ /dev/null @@ -1,30 +0,0 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - -name: Node.js CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18.x, 20.x, 21.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci - - run: npm run build --if-present