This repository has been archived by the owner on Mar 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (84 loc) · 2.6 KB
/
cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Continuous Deployment
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
tags:
- '*'
env:
IMAGE_TAG: ${{ github.sha }}
jobs:
test-and-lint:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- name: Setup
run: |
npm install
- name: Lint
run: |
npm run lint
- name: Unit Test
run: |
npm run test
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build Container Images
run: |
RUN_ENV=prod make build
mkdir -p docker-image
docker save -o docker-image/editor-article-store.tar editor-article-store:${IMAGE_TAG}
- uses: actions/upload-artifact@v1
with:
name: docker-image
path: docker-image
functional-tests-and-push:
needs: [test-and-lint, build]
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/download-artifact@v1
with:
name: docker-image
- name: Load Images & Setup Services
run: |
docker load -i docker-image/editor-article-store.tar
make start_services
IMAGE_TAG=${IMAGE_TAG} docker-compose up -d editor-article-store
- name: Run functional tests
run: |
npm install
npm run test:functional
- name: Publish as 'unstable'
if: github.ref == 'refs/heads/master'
run: |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker build --no-cache -t $DOCKER_USERNAME/$REPO_NAME:unstable .
docker push $DOCKER_USERNAME/$REPO_NAME:unstable
.scripts/github/retag-and-push.sh $REPO_NAME unstable
env:
REPO_NAME: ${{ github.event.repository.name }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish as 'stable'
if: contains(github.ref, 'refs/tags/v')
run: |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker build --no-cache -t $DOCKER_USERNAME/$REPO_NAME:stable .
docker push $DOCKER_USERNAME/$REPO_NAME:stable
.scripts/github/retag-and-push.sh $REPO_NAME stable
env:
REPO_NAME: ${{ github.event.repository.name }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}