Merge pull request #58 from ProvideQ/main #130
This file contains 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@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- 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@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- 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@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- 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/develop' }} | |
steps: | |
- name: Cloning repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Push to dokku | |
uses: dokku/github-action@master | |
with: | |
branch: develop | |
# only extracting the server address to a secret avoids leaking it in the logs | |
git_remote_url: ssh://dokku@${{ secrets.DOKKU_SERVER_ADDRESS }}/toolbox-frontend-staging | |
ssh_private_key: ${{ secrets.DOKKU_DEPLOYMENT_KEY }} |