name: Build Hugo on: push: branches: [ "main" ] env: REGISTRY: tea.ahmza.com IMAGE_NAME: ${{ gitea.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 Gitea Container Registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ gitea.repository_owner }} password: ${{ secrets.GITEATOKEN }} - 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: context: . platforms: linux/arm64, linux/amd64 push: true build-args: | BUILDKIT_CONTEXT_KEEP_GIT_DIR=true tags: | ${{ env.REGISTRY }}/${{ gitea.repository_owner }}/blog-ahmza-com:latest ${{ env.REGISTRY }}/${{ gitea.repository_owner }}/blog-ahmza-com:${{ gitea.event.head_commit.id }} cache-from: type=gha cache-to: type=gha,mode=max deploy-to-rpic: 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 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' deploy-to-gimli-blog: 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 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'