✨ feat: add workflow_dispatch parameters for testing Docker push independently
This commit is contained in:
@@ -6,7 +6,18 @@
|
|||||||
name: CI/CD Pipeline
|
name: CI/CD Pipeline
|
||||||
|
|
||||||
on:
|
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:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
@@ -132,7 +143,7 @@ jobs:
|
|||||||
name: CI Pipeline
|
name: CI Pipeline
|
||||||
needs: build-cache
|
needs: build-cache
|
||||||
runs-on: ubuntu-latest-ca
|
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:
|
container:
|
||||||
image: ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}-build-cache:${{ needs.build-cache.outputs.deps_hash }}
|
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:
|
docker-push:
|
||||||
name: Docker Push
|
name: Docker Push
|
||||||
needs: [build-cache, ci-pipeline]
|
needs: build-cache
|
||||||
runs-on: ubuntu-latest-ca
|
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:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Login to Gitea Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user