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 Buildah run: | apt-get update -qq apt-get install -y -qq buildah fuse-overlayfs uidmap # Configure storage mkdir -p /root/.local/share/containers buildah version - name: Build and Push with Buildah env: REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} run: | # Login to Gitea Registry echo "$REGISTRY_TOKEN" | \ buildah login ${{ env.REGISTRY }} -u luochen570 --password-stdin # Build container image (daemonless!) buildah bud -t ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} . # Push to registry buildah push ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} # Also tag as latest buildah tag ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} \ ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest buildah push ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest - name: Deploy to k3s run: | echo "kubectl deploy - skip for now, need runner kubectl access" # kubectl set image deployment/hugo-blog -n hugo \ # nginx=${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}