Skip to content

Merge pull request #86 from nakajimayoshi/bot-migration #83

Merge pull request #86 from nakajimayoshi/bot-migration

Merge pull request #86 from nakajimayoshi/bot-migration #83

Workflow file for this run

name: Production CI
on:
push:
branches:
- main
jobs:
lint_helm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: heavydivision/heavy-division-bot
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=heavy-division/heavy-division-bot: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: heavy-division-bot
RELEASE_NAME: heavy-division-bot
VALUES_FILE: ./charts/discord-bot/environments/production.yaml
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
METAR_TOKEN: ${{ secrets.METAR_TOKEN }}
STATION_TOKEN: ${{ secrets.STATION_TOKEN }}
MONGODB_URL: ${{ secrets.MONGODB_URL }}
BAN_APPEAL_URL: ${{ secrets.BAN_APPEAL_URL }}
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 --install --namespace ${NAMESPACE} \
--set image.tag=sha-${TAG} \
--set bot.discordToken=${DISCORD_TOKEN} \
--set bot.metarToken=${METAR_TOKEN} \
--set bot.stationToken=${STATION_TOKEN} \
--set bot.mongodbUrl=${MONGODB_URL} \
--set bot.banAppealUrl=${BAN_APPEAL_URL} \
-f ./charts/discord-bot/values.yaml -f ${VALUES_FILE} ${RELEASE_NAME} ./charts/discord-bot