2021-08-20 00:56:07 +00:00
|
|
|
name: Deployment pipeline
|
2021-08-20 00:33:28 +00:00
|
|
|
|
2021-08-20 06:28:34 +00:00
|
|
|
on: [push, pull_request]
|
2021-08-20 00:33:28 +00:00
|
|
|
|
|
|
|
jobs:
|
2021-08-20 06:28:34 +00:00
|
|
|
lint:
|
|
|
|
name: Lint
|
2021-08-27 16:48:24 +00:00
|
|
|
timeout-minutes: 4
|
2021-08-20 06:28:34 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-08-27 20:18:03 +00:00
|
|
|
node-version: 14
|
2021-08-27 16:48:24 +00:00
|
|
|
- run: npm ci
|
2021-08-20 06:28:34 +00:00
|
|
|
- run: npm run lint
|
|
|
|
|
|
|
|
test:
|
|
|
|
name: Test
|
2021-08-27 16:48:24 +00:00
|
|
|
timeout-minutes: 4
|
2021-08-20 06:28:34 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-08-27 20:18:03 +00:00
|
|
|
node-version: 14
|
2021-08-27 16:48:24 +00:00
|
|
|
- run: npm ci
|
2021-08-20 06:28:34 +00:00
|
|
|
- run: npm test
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: Compile
|
2021-08-27 17:02:27 +00:00
|
|
|
timeout-minutes: 6
|
2021-08-20 06:28:34 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-08-27 20:18:03 +00:00
|
|
|
node-version: 14
|
2021-08-27 16:48:24 +00:00
|
|
|
- run: npm ci
|
2021-08-20 06:28:34 +00:00
|
|
|
- run: npm run build
|
|
|
|
env:
|
|
|
|
DATOCMS_API_TOKEN: ${{ secrets.DATOCMS_API_TOKEN }}
|
|
|
|
QUIRREL_BASE_URL: doesntmatter.shellphone.app
|
|
|
|
|
|
|
|
deploy_dev:
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
needs: [lint, test, build]
|
|
|
|
name: Deploy dev.shellphone.app
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-08-27 14:32:34 +00:00
|
|
|
- uses: superfly/flyctl-actions@master
|
2021-08-20 06:28:34 +00:00
|
|
|
env:
|
2021-08-27 14:32:34 +00:00
|
|
|
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
|
|
with:
|
2021-08-27 21:29:14 +00:00
|
|
|
args: "deploy -c ./fly.dev.toml --build-arg DATOCMS_API_TOKEN=${{ secrets.DATOCMS_API_TOKEN }}"
|
2021-08-20 06:28:34 +00:00
|
|
|
|
|
|
|
deploy_prod:
|
|
|
|
if: github.ref == 'refs/heads/production'
|
|
|
|
needs: [lint, test, build]
|
|
|
|
name: Deploy www.shellphone.app
|
2021-08-20 00:33:28 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-08-27 14:32:34 +00:00
|
|
|
- uses: superfly/flyctl-actions@master
|
2021-08-20 00:33:28 +00:00
|
|
|
env:
|
2021-08-27 14:32:34 +00:00
|
|
|
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
|
|
with:
|
2021-08-27 21:29:14 +00:00
|
|
|
args: "deploy -c ./fly.prod.toml --build-arg DATOCMS_API_TOKEN=${{ secrets.DATOCMS_API_TOKEN }}"
|
2021-08-20 06:41:37 +00:00
|
|
|
# TODO: on pull_request, deploy 24hour-long deployment at {commit_short_hash}.shellphone.app, provision db and seed data
|