-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
63 lines (63 loc) · 2.12 KB
/
.travis.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
os: linux
dist: jammy
language: python
python:
- '3.10'
before_install:
- pip install --upgrade pip setuptools
branches:
only:
- master
- CD
jobs:
include:
- name: Au-tuan test
install:
- pip install tox
script:
- tox -e test
- name: checkmigrations
install:
- pip install tox
script:
- tox -e checkmigrations
- name: Au-tuan flake8
install:
- pip install tox
script:
- tox -e flake8
- stage: docker
name: docker build
services:
- docker
script:
- docker-compose build
- stage: deploy
name: deploy
if: (type = push or type = cron) and (branch = master or branch = CD)
install:
- pip install ansible
before_script:
- mkdir -p "${HOME}/.ssh/"
- TRAVIS_TSUKI_SSH_KEY_PATH="${HOME}/.ssh/id_ed25519_travis"
- echo "${DEPLOY_HOST} ssh-ed25519 ${DEPLOY_HOST_SSH_PUBLICKEY}" >> ${HOME}/.ssh/known_hosts
- echo "${DEPLOY_HOST_USER_SSH_KEY}" | base64 --decode > "${TRAVIS_TSUKI_SSH_KEY_PATH}"
# Recreate the certificate from the secure environment variable
- chmod 400 "${TRAVIS_TSUKI_SSH_KEY_PATH}"
script:
- '
ansible-playbook -i deploy/inventory_travis deploy/deploy.yaml
--extra-vars "tsuanan_repo=`basename ${TRAVIS_REPO_SLUG}`"
--extra-vars "branch=${TRAVIS_BRANCH}"
--extra-vars "DEPLOY_HOST=${DEPLOY_HOST}"
--extra-vars "DEPLOY_HOST_USER=${DEPLOY_HOST_USER}"
--extra-vars "TRAVIS_TSUKI_SSH_KEY_PATH=${TRAVIS_TSUKI_SSH_KEY_PATH}"
--extra-vars "VIRTUAL_HOST_TSIANTUAN=${VIRTUAL_HOST_TSIANTUAN}"
--extra-vars "VIRTUAL_HOST_AUTUAN=${VIRTUAL_HOST_AUTUAN}"
--extra-vars "SECRET_KEY=${SECRET_KEY}"
--extra-vars "SENTRY_DSN=${SENTRY_DSN}"
--extra-vars "AWS_S3_ENDPOINT_URL=${AWS_S3_ENDPOINT_URL}"
--extra-vars "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}"
--extra-vars "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}"
# --extra-vars 其他 .env.template 變數
'