75 lines
2.2 KiB
YAML
75 lines
2.2 KiB
YAML
name: Build and Deploy
|
|
run-name: ${{ gitea.actor }} is building container
|
|
on: [push]
|
|
|
|
jobs:
|
|
Build-Container-Image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
git.dev-null.rocks/alexohneander/alexohneander-zola
|
|
tags: |
|
|
type=schedule,pattern={{date 'YYYYMMDDHHMM'}}
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=sha
|
|
|
|
- name: Set up Docker Context for Buildx
|
|
id: buildx-context
|
|
run: |
|
|
export DOCKER_HOST=tcp://docker:2376/
|
|
export DOCKER_TLS_CERTDIR="/certs"
|
|
export DOCKER_TLS_VERIFY=1
|
|
export DOCKER_CERT_PATH="/certs/client"
|
|
docker context create builders
|
|
|
|
- name: Setup Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
# buildkitd-flags: --debug
|
|
endpoint: builders
|
|
env:
|
|
DOCKER_HOST: "tcp://docker:2376/"
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
DOCKER_TLS_VERIFY: 1
|
|
DOCKER_CERT_PATH: "/certs/client"
|
|
|
|
- name: Login to Gitea
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.dev-null.rocks
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GA_TOKEN }}
|
|
|
|
- name: Build and push the image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
file: Dockerfile
|
|
platforms: linux/amd64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
env:
|
|
DOCKER_HOST: "tcp://docker:2376/"
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
DOCKER_TLS_VERIFY: 1
|
|
DOCKER_CERT_PATH: "/certs/client"
|
|
Deployment:
|
|
runs-on: ubuntu-latest
|
|
needs: Build-Container-Image
|
|
steps:
|
|
- name: Update image tag for container alexohneander-zola in deployment.yaml
|
|
uses: loveholidays/gitops-action-yaml-updater@v1.0
|
|
with:
|
|
mode: IMAGE_TAG
|
|
container-name: alexohneander-zola
|
|
new-image-tag: ${{ github.sha }}
|
|
dir: deploy/
|
|
files: deployment.yaml
|