add gitea workflow

This commit is contained in:
James Brumond 2023-08-20 18:52:10 -07:00
parent fdfbdaa270
commit ffd7e3d96f
Signed by: james
GPG Key ID: E8F2FC44BAA3357A
4 changed files with 177 additions and 0 deletions

View File

@ -0,0 +1,44 @@
name: Build and publish container images
on:
workflow_dispatch: { }
# push:
# branches:
# - master
jobs:
build-and-publish:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- 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: Build and publish
uses: docker/build-push-action@v4
env:
# see <https://docs.gitea.com/usage/actions/comparison#dockerbuild-push-actionv4>
ACTIONS_RUNTIME_TOKEN: ''
with:
context: .
push: true
tags: |
gitea.jbrumond.me/<org name>/<image name>:latest
platforms: |
linux/amd64
linux/arm64

View File

@ -0,0 +1,35 @@
name: Build container images
on:
workflow_dispatch: { }
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and publish
uses: docker/build-push-action@v4
env:
# see <https://docs.gitea.com/usage/actions/comparison#dockerbuild-push-actionv4>
ACTIONS_RUNTIME_TOKEN: ''
with:
context: .
push: false
platforms: |
linux/amd64
linux/arm64

View File

@ -0,0 +1,49 @@
name: Deploy staging to production environment
on:
workflow_dispatch: { }
# push:
# branches:
# - master
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/<org name>/<image name>:stg
docker tag gitea.jbrumond.me/<org name>/<image name>:stg gitea.jbrumond.me/<org name>/<image name>:prod
docker push gitea.jbrumond.me/<org name>/<image name>: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/<org name>/<image name>:prod"
kubectl -n web rollout restart "deployment/<prod deploy name>"
kubectl -n web rollout status "deployment/<prod deploy name>"

View File

@ -0,0 +1,49 @@
name: Deploy latest to staging environment
on:
workflow_dispatch: { }
# push:
# branches:
# - master
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 "latest" with "stg"
run: |
docker pull gitea.jbrumond.me/<org name>/<image name>:latest
docker tag gitea.jbrumond.me/<org name>/<image name>:latest gitea.jbrumond.me/<org name>/<image name>:stg
docker push gitea.jbrumond.me/<org name>/<image name>:stg
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 "stg" image to kubernetes staging (<stg hostname>)
run: |
kubectl -n web set image "deployment/<stg deploy name>" "<stg container name>=gitea.jbrumond.me/<org name>/<image name>:stg"
kubectl -n web rollout restart "deployment/<stg deploy name>"
kubectl -n web rollout status "deployment/<stg deploy name>"