Skip to content

Merge pull request #144 from flybywiresim/mrc-aviationweather #63

Merge pull request #144 from flybywiresim/mrc-aviationweather

Merge pull request #144 from flybywiresim/mrc-aviationweather #63

Workflow file for this run

name: Production CI
on:
push:
branches:
- main
jobs:
lint_helm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Lint Helm
run: helm lint ./charts/fbw-api
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: flybywiresim/api
tag-sha: true
tag-latest: false
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- 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
id: docker_build
uses: docker/build-push-action@v2
with:
cache-from: type=registry,ref=flybywiresim/api:main
cache-to: type=inline
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
deploy_production:
runs-on: ubuntu-latest
needs: [build_and_push, lint_helm]
env:
NAMESPACE: fbw-api-prod
RELEASE_NAME: fbw-api-prod
VALUES_FILE: ./charts/fbw-api/environments/production.yaml
DB_PASSWORD: ${{ secrets.PROD_DB_PASSWORD }}
AUTH_SECRET: ${{ secrets.PROD_AUTH_SECRET }}
GITHUB_TOKEN: ${{ secrets.GH_API_TOKEN }}
DISCORD_WEBHOOK: ${{ secrets.PROD_DISCORD_WEBHOOK }}
steps:
- uses: actions/checkout@v1
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save ${{ secrets.DIGITALOCEAN_CLUSTER_ID }}
- name: Deploy
run: |
TAG=$(echo $GITHUB_SHA | head -c7) &&
helm upgrade --namespace ${NAMESPACE} --set api.database.password=${DB_PASSWORD},api.auth.secret=${AUTH_SECRET},image.tag=sha-${TAG} \
--set api.github.token=${GITHUB_TOKEN},api.telex.discordWebhook=${DISCORD_WEBHOOK} \
-f ./charts/fbw-api/values.yaml -f ${VALUES_FILE} ${RELEASE_NAME} ./charts/fbw-api