Skip to content

Commit de19faf

Browse files
committed
Combine test and deploy workflows.
1 parent dcda896 commit de19faf

File tree

3 files changed

+26
-70
lines changed

3 files changed

+26
-70
lines changed
Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,47 @@
1-
name: Deploy
1+
name: Test & Deploy
22
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
workflow_dispatch:
38
release:
4-
types: [published]
9+
types:
10+
- published
11+
512
jobs:
613
test:
7-
name: Test
814
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
917
steps:
18+
- name: Cancel Previous Runs
19+
uses: styfle/cancel-workflow-action@0.4.0
20+
with:
21+
access_token: ${{ github.token }}
22+
1023
- uses: actions/checkout@v2
1124

1225
- uses: actions/setup-node@v2
1326
with:
1427
node-version: "15"
1528
check-latest: true
1629

17-
- name: Cache node modules
18-
uses: actions/cache@v2
19-
with:
20-
path: node_modules
21-
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
22-
restore-keys: |
23-
${{ runner.OS }}-build-${{ env.cache-name }}-
24-
${{ runner.OS }}-build-
25-
${{ runner.OS }}-
26-
2730
- run: make envvar
2831

29-
# Pull the latest image to build, and avoid caching pull-only images.
30-
# (docker pull is faster than caching in most cases.)
31-
- run: docker-compose pull
32-
33-
# In this step, this action saves a list of existing images,
34-
# the cache is created without them in the post run.
35-
# It also restores the cache if it exists.
36-
- uses: satackey/action-docker-layer-caching@v0.0.11
37-
# Ignore the failure of a step and avoid terminating the job.
38-
continue-on-error: true
32+
- run: make pull
3933

4034
- run: make image
4135

4236
- run: make test
4337

4438
deploy:
45-
name: Deploy
39+
if: github.event.action == 'published' && github.repository == 'jazzband-roadies/website'
40+
4641
runs-on: ubuntu-latest
42+
4743
needs: [test]
44+
4845
steps:
4946
- name: Cancel Previous Runs
5047
uses: styfle/cancel-workflow-action@0.4.0
@@ -57,10 +54,9 @@ jobs:
5754
fetch-depth: 0
5855

5956
- name: Push
60-
uses: dokku/github-action@v1
57+
uses: dokku/github-action@v1.0.2
6158
# enable verbose ssh output
6259
with:
63-
# specify `--force` as a flag for git pushes
6460
git_push_flags: "--force"
6561
git_remote_url: ${{ secrets.SSH_REMOTE_URL }}
6662
ssh_private_key: ${{ secrets.PRIVATE_KEY }}

.github/workflows/test.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: bash npm-build npm-install build clean db-migrate db-upgrade redis-cli run shell start stop update test pytest image envvar ci cert trust
1+
.PHONY: bash npm-build npm-install build clean db-migrate db-upgrade redis-cli run shell start stop update test pytest image envvar ci cert trust pull
22

33
bash:
44
docker-compose run --rm web bash
@@ -9,6 +9,9 @@ npm-install:
99
npm-build:
1010
npm run build
1111

12+
pull:
13+
docker-compose pull
14+
1215
image:
1316
docker-compose build --pull
1417

0 commit comments

Comments
 (0)