Skip to content

Merge pull request #329 from techman83/fix/coverage #142

Merge pull request #329 from techman83/fix/coverage

Merge pull request #329 from techman83/fix/coverage #142

Workflow file for this run

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 }}