diff --git a/.gitea/workflows/ci-cd.yaml b/.gitea/workflows/ci-cd.yaml index 019b3c2..12c2de5 100644 --- a/.gitea/workflows/ci-cd.yaml +++ b/.gitea/workflows/ci-cd.yaml @@ -6,7 +6,18 @@ name: CI/CD Pipeline on: - workflow_dispatch: {} + workflow_dispatch: + inputs: + skip_ci: + description: 'Skip CI pipeline and go straight to Docker push' + required: false + type: boolean + default: false + test_docker_only: + description: 'Test only Docker push steps (requires skip_ci=true)' + required: false + type: boolean + default: false push: branches: - main @@ -132,7 +143,7 @@ jobs: name: CI Pipeline needs: build-cache runs-on: ubuntu-latest-ca - if: "!contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'ci-bot'" + if: "!contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'ci-bot' && (!github.event.inputs.skip_ci || github.event.inputs.skip_ci == 'false')" container: image: ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}-build-cache:${{ needs.build-cache.outputs.deps_hash }} @@ -308,14 +319,30 @@ jobs: docker-push: name: Docker Push - needs: [build-cache, ci-pipeline] + needs: build-cache runs-on: ubuntu-latest-ca - if: "!contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'ci-bot' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature/move-docker-job')" + if: "!contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'ci-bot' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature/move-docker-job' || github.event.inputs.test_docker_only == 'true')" steps: - name: Checkout code uses: actions/checkout@v4 + - name: Restore Swagger Docs Cache + id: cache-swagger-restore + uses: actions/cache/restore@v5 + with: + path: | + pkg/server/docs/docs.go + pkg/server/docs/swagger.json + pkg/server/docs/swagger.yaml + key: swagger-docs-${{ hashFiles('cmd/server/main.go', 'pkg/greet/*.go', 'pkg/server/*.go', 'go.mod') }} + restore-keys: | + swagger-docs- + + - name: Generate Swagger Docs (if not cached) + if: steps.cache-swagger-restore.outputs.cache-hit != 'true' || github.event.inputs.skip_ci == 'true' + run: go generate ./pkg/server + - name: Login to Gitea Container Registry uses: docker/login-action@v3 with: