Feavy/pokemon-discord-poc

View on GitHub
.github/workflows/kubernetes.yml

Summary

Maintainability
Test Coverage
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Build & Deploy to Kubernetes

on:
  push:
    branches: [ master ]
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Set up JDK 11
      uses: actions/setup-java@v3
      with:
        java-version: '11'
        distribution: 'adopt'

    - name: Grant execute permission for gradlew
      run: chmod +x gradlew

    - name: Build with Gradle
      run: ./gradlew shadowJar

    - name: Archive production artifacts
      uses: actions/upload-artifact@v2
      with:
        name: build-jars
        path: |
          build/libs

    - uses: feavy/deploy@main
      env:
        KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
        GITHUB_USERNAME: feavy
        GITHUB_TOKEN: ${{ secrets.PAT }}
        DOCKERFILE_PATH: .
        DOCKER_IMAGE: pokemon-discord:latest
        DEPLOYMENT: deployment.yml
        BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
        HOST: https://pkmn.feavy.fr
        PLATFORM: arm64

    - name: Restart deployment
      run: kubectl rollout restart deployment pokemon-discord --namespace feavy