name: Deploy Hugo Blog to k3s on: push: branches: [main] workflow_dispatch: env: REGISTRY: git.luochen570.cn IMAGE: luochen570/hugo-blog jobs: build-and-deploy: runs-on: ubuntu-latest permissions: contents: read steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Hugo uses: peaceiris/actions-hugo@v3 with: hugo-version: '0.161.1' extended: true - name: Hugo Build run: hugo --minify - name: Install Podman run: | apt-get update -qq apt-get install -y -qq podman fuse-overlayfs # Configure Podman for Gitea Registry mkdir -p /etc/containers/registries.conf.d cat > /etc/containers/registries.conf.d/gitea-registry.conf < /tmp/kubeconfig.json # Download kubectl curl -fsSLO "https://dl.k8s.io/release/v1.32.0/bin/linux/amd64/kubectl" chmod +x kubectl # Rollout new image ./kubectl --kubeconfig /tmp/kubeconfig.json \ set image deployment/hugo-blog -n hugo \ nginx=${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} ./kubectl --kubeconfig /tmp/kubeconfig.json \ rollout status deployment/hugo-blog -n hugo --timeout=120s