Merge pull request #30 from justinfarrelldev/staging #97
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
name: Deploy to Preview | |
on: | |
push: | |
branches: | |
- staging | |
- main | |
jobs: | |
test: | |
name: Test App | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache npm dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm # Cache location | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} # Cache key | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: npm install | |
- name: Run tests | |
run: npm run test | |
deploy: | |
name: Deploy App to Production | |
needs: test | |
runs-on: ubuntu-latest | |
concurrency: deploy-group # optional: ensure only one action runs at a time | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: npm run deploy | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |