Skip to content

Merge pull request #344 from HebaruSan/feature/optional-sha1 #159

Merge pull request #344 from HebaruSan/feature/optional-sha1

Merge pull request #344 from HebaruSan/feature/optional-sha1 #159

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@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run tests before deploying
uses: docker/build-push-action@v5
with:
context: ./netkan
file: ./netkan/Dockerfile
push: false
target: test
- name: Build and push NetKAN-infra
uses: docker/build-push-action@v5
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@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push webhooks-proxy
id: docker_build
uses: docker/build-push-action@v5
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.12
cache: pip
- 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: |
for SERVICE in Indexer Webhooks Adder Mirrorer
do
netkan redeploy-service --cluster NetKANCluster --service-name $SERVICE &
done
wait
- name: CKAN repo dispatch
env:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
if: env.REPO_ACCESS_TOKEN
uses: peter-evans/repository-dispatch@v3
with:
repository: KSP-CKAN/CKAN
event-type: deploy
token: ${{ secrets.REPO_ACCESS_TOKEN }}