style: fix linter issue #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # adapted from https://github.com/dokku/github-action/blob/db5e3b84461e5e73c56d8b0f6a67aab0df25256c/example-workflows/simple.yml | |
| name: "CI/CD" | |
| on: | |
| push: | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone repo (shallow) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ">=18.14.0" | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn install | |
| - name: Run linter | |
| run: yarn lint | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone repo (shallow) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ">=18.14.0" | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn install | |
| - name: Run tests | |
| run: yarn test | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone repo (shallow) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ">=18.14.0" | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn install | |
| - name: Run tests | |
| run: yarn build | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - lint | |
| - test | |
| - build | |
| if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }} | |
| steps: | |
| - name: Deploy via SSH and Docker Compose | |
| uses: appleboy/ssh-action@068c0c7a4e59a5ae12fb7cb454b05735d830c82b #v1.25 | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| username: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.DEPLOY_SSH_KEY }} | |
| command_timeout: 60m | |
| script: | | |
| echo "Deploying ${{ github.event.repository.name }} to '${{ github.ref_name }}' environment" | |
| sh /root/ProvideQ/${{ github.event.repository.name }}/deploy.sh ${{ github.ref_name }} |