name: Build with Kaniko (Hardcoded No Vars) on: push: branches: [ main ] workflow_dispatch: permissions: packages: write contents: read jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Build and Push uses: docker://gcr.io/kaniko-project/executor:v1.23.2-debug with: entrypoint: /busybox/sh # 注意:下面所有出现域名的地方都直接写死了,确保不会出错 args: >- -c " echo '正在生成认证信息...' && echo '{\"auths\":{\"gitea.173114.xyz\":{\"username\":\"${{ gitea.actor }}\",\"password\":\"${{ secrets.PACKAGES_TOKEN }}\"}}}' > /kaniko/.docker/config.json && echo '认证文件已生成,开始构建...' && /kaniko/executor \ --context=. \ --dockerfile=Dockerfile \ --destination=gitea-http.gitea.svc.cluster.local:3000/${{ gitea.actor }}/my-docs:latest \ --destination=gitea-http.gitea.svc.cluster.local:3000/${{ gitea.actor }}/my-docs:${{ github.sha }} \ --insecure \ --skip-tls-verify \ --cache=true "