Create Path object once whne loading config #90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to production | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
push_docker_image: | |
name: Build & Publish Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create SHA Container Tag | |
id: sha_tag | |
run: | | |
tag=$(cut -c 1-7 <<< $GITHUB_SHA) | |
echo "::set-output name=tag::$tag" | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Github Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# This step builds and pushed the container to the | |
# Github Container Registry tagged with "latest" and | |
# the short SHA of the commit. | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
cache-from: type=registry,ref=ghcr.io/python-discord/metricity:latest | |
tags: | | |
ghcr.io/python-discord/metricity:latest | |
ghcr.io/python-discord/metricity:${{ steps.sha_tag.outputs.tag }} | |
- uses: azure/setup-kubectl@v3 | |
- name: Authenticate with Kubernetes | |
uses: azure/k8s-set-context@v3 | |
with: | |
method: kubeconfig | |
kubeconfig: ${{ secrets.KUBECONFIG }} | |
- name: Deploy to Kubernetes | |
uses: Azure/k8s-deploy@v4 | |
with: | |
manifests: | | |
deployment.yaml | |
images: 'ghcr.io/python-discord/metricity:${{ steps.sha_tag.outputs.tag }}' |