Files
blog-ahmza-com/.github/workflows/build-docker-images.yml
T

77 lines
2.1 KiB
YAML

name: Build Hugo
on:
push:
branches: [ "main" ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/arm64, linux/amd64
push: true
build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
tags: |
ghcr.io/${{ github.repository_owner }}/blog-ahmza-com:latest
ghcr.io/${{ github.repository_owner }}/blog-ahmza-com:${{ github.event.head_commit.id }}
deployment:
runs-on: ubuntu-latest
needs: build
steps:
- name: Netbird Connect
uses: Alemiz112/netbird-connect@v1
with:
setup-key: ${{ secrets.NETBIRD_SETUP_KEY }}
hostname: 'blog-gh-actions'
management-url: ${{ secrets.NETBIRD_URL }}
- name: Deploy to RPIC Cluster
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: 'kubectl rollout restart deployment blog -n blog-ahmza-com'
- name: Deploy to gimli-blog
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.GIMLI_BLOG_HOST }}
username: ${{ secrets.GIMLI_BLOG_USER }}
key: ${{ secrets.GIMLI_BLOG_KEY }}
port: ${{ secrets.GIMLI_BLOG_PORT }}
script: 'docker compose down && docker compose pull && docker compose up -d'