-
Notifications
You must be signed in to change notification settings - Fork 6
92 lines (89 loc) · 2.92 KB
/
deploy.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
88
89
90
91
92
name: Deploy NetKAN-Infra
on:
push:
branches:
- master
jobs:
build:
if: ${{ github.repository == 'KSP-CKAN/NetKAN-Infra' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run tests before deploying
uses: docker/build-push-action@v2
with:
context: ./netkan
file: ./netkan/Dockerfile
push: false
target: test
- name: Build and push NetKAN-infra
uses: docker/build-push-action@v2
with:
context: ./netkan
file: ./netkan/Dockerfile
push: true
target: production
tags: kspckan/netkan:latest
webhooks:
if: ${{ github.repository == 'KSP-CKAN/NetKAN-Infra' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push webhooks-proxy
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./nginx
file: ./nginx/Dockerfile
push: true
tags: kspckan/webhooks-proxy:latest
deploy:
if: ${{ github.repository == 'KSP-CKAN/NetKAN-Infra' }}
runs-on: ubuntu-latest
needs: [ 'build', 'webhooks' ]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: pip
cache-dependency-path: netkan/setup.py
- name: Install Dependencies
run: |
pip install netkan/.
- name: Re-deploy Containers
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
run: |
netkan redeploy-service --cluster NetKANCluster --service-name Indexer
netkan redeploy-service --cluster NetKANCluster --service-name Webhooks
netkan redeploy-service --cluster NetKANCluster --service-name Adder
netkan redeploy-service --cluster NetKANCluster --service-name Mirrorer
- name: CKAN repo dispatch
env:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
if: env.REPO_ACCESS_TOKEN
uses: peter-evans/repository-dispatch@v2
with:
repository: KSP-CKAN/CKAN
event-type: deploy
token: ${{ secrets.REPO_ACCESS_TOKEN }}