Skip to content

more

more #2

Workflow file for this run

name: k8s-deploy
on:
push:
branches:
- main
- k8s-deploy
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
production-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out latest commit
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: osuAkatsuki/new-cron
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/new-cron:latest
${{ secrets.DOCKERHUB_USERNAME }}/new-cron:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
- name: Get kubeconfig from github secrets
run: |
mkdir -p $HOME/.kube
echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
- name: Deploy cronjob to production cluster
run: |
kubectl apply -f k8s/cronjob.yaml