47 lines
1.5 KiB
YAML
47 lines
1.5 KiB
YAML
|
|
name: Deploy staging to production environment
|
|
|
|
on:
|
|
- workflow_dispatch
|
|
|
|
jobs:
|
|
tag-image:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: gitea.jbrumond.me
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Tag "stg" with "prod"
|
|
run: |
|
|
docker pull gitea.jbrumond.me/james/dashboard:stg
|
|
docker tag gitea.jbrumond.me/james/dashboard:stg gitea.jbrumond.me/james/dashboard:prod
|
|
docker push gitea.jbrumond.me/james/dashboard:prod
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: gitea.jbrumond.me/images/kubectl:1.28
|
|
needs:
|
|
- tag-image
|
|
env:
|
|
KUBERNETES_SERVER: https://nephthys.local.jbrumond.me:6443
|
|
KUBERNETES_TOKEN: ${{ secrets.K8S_WEB_NS_SERVICE_ACCT_TOKEN }}
|
|
KUBERNETES_CERT: ${{ secrets.K8S_WEB_NS_SERVICE_ACCT_CERT }}
|
|
steps:
|
|
- name: Configure kubectl and set credentials
|
|
run: /bin/kubectl-setup
|
|
- name: Deploy "prod" image to kubernetes production (<prod hostname>)
|
|
run: |
|
|
kubectl -n web set image "deployment/<prod deploy name>" "<prod container name>=gitea.jbrumond.me/james/dashboard:prod"
|
|
kubectl -n web rollout restart "deployment/<prod deploy name>"
|
|
kubectl -n web rollout status "deployment/<prod deploy name>"
|