|
1 | 1 | name: ci |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | 5 | branches: |
|
10 | 11 |
|
11 | 12 | permissions: |
12 | 13 | contents: write |
| 14 | + id-token: write |
| 15 | + issues: write |
13 | 16 | packages: write |
14 | 17 | pull-requests: write |
15 | 18 |
|
| 19 | +concurrency: |
| 20 | + group: ${{ github.ref }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
16 | 23 | jobs: |
17 | | - pipe: |
18 | | - concurrency: |
19 | | - group: ${{ github.ref }} |
20 | | - cancel-in-progress: true |
21 | | - uses: platform-mesh/.github/.github/workflows/pipeline-golang-app.yml@main |
| 24 | + lint: |
| 25 | + uses: platform-mesh/.github/.github/workflows/job-golang-lint.yml@main |
| 26 | + with: |
| 27 | + useMake: true |
| 28 | + |
| 29 | + test: |
| 30 | + uses: platform-mesh/.github/.github/workflows/job-golang-test-source.yml@main |
22 | 31 | secrets: inherit |
23 | 32 | with: |
24 | | - imageTagName: ghcr.io/platform-mesh/example-httpbin-operator |
25 | | - repoVersionUpdate: platform-mesh/helm-charts |
26 | 33 | useMake: true |
27 | 34 | useLocalCoverageConfig: true |
28 | 35 |
|
| 36 | + docker-build: |
| 37 | + if: github.event_name == 'pull_request' |
| 38 | + uses: platform-mesh/.github/.github/workflows/job-docker-build-push.yml@main |
| 39 | + with: |
| 40 | + imageTagName: ghcr.io/platform-mesh/example-httpbin-operator |
| 41 | + secrets: inherit |
| 42 | + |
| 43 | + quality-gate: |
| 44 | + if: always() |
| 45 | + permissions: {} |
| 46 | + needs: [lint, test, docker-build] |
| 47 | + runs-on: ubuntu-latest |
| 48 | + timeout-minutes: 1 |
| 49 | + steps: |
| 50 | + - name: Check results |
| 51 | + run: | |
| 52 | + if [[ "${{ needs.lint.result }}" != "success" ]]; then |
| 53 | + echo "lint failed" |
| 54 | + exit 1 |
| 55 | + fi |
| 56 | + if [[ "${{ needs.test.result }}" != "success" ]]; then |
| 57 | + echo "test failed" |
| 58 | + exit 1 |
| 59 | + fi |
| 60 | + # docker-build is skipped on main pushes — allow skipped |
| 61 | + if [[ "${{ needs.docker-build.result }}" != "success" && "${{ needs.docker-build.result }}" != "skipped" ]]; then |
| 62 | + echo "docker-build failed" |
| 63 | + exit 1 |
| 64 | + fi |
| 65 | +
|
| 66 | + create-version: |
| 67 | + if: github.ref == 'refs/heads/main' |
| 68 | + uses: platform-mesh/.github/.github/workflows/job-create-version.yml@main |
| 69 | + secrets: inherit |
| 70 | + |
| 71 | + docker-build-push: |
| 72 | + if: github.ref == 'refs/heads/main' |
| 73 | + needs: [create-version, lint, test] |
| 74 | + uses: platform-mesh/.github/.github/workflows/job-docker-build-push.yml@main |
| 75 | + with: |
| 76 | + imageTagName: ghcr.io/platform-mesh/example-httpbin-operator |
| 77 | + version: ${{ needs.create-version.outputs.version }} |
| 78 | + multiarch: true |
| 79 | + secrets: inherit |
| 80 | + |
| 81 | + update-version: |
| 82 | + if: github.ref == 'refs/heads/main' |
| 83 | + needs: [create-version, docker-build-push] |
| 84 | + uses: platform-mesh/.github/.github/workflows/job-chart-version-update.yml@main |
| 85 | + secrets: inherit |
| 86 | + with: |
| 87 | + appVersion: ${{ needs.create-version.outputs.version }} |
| 88 | + chart: example-httpbin-operator |
| 89 | + targetRepository: platform-mesh/helm-charts |
| 90 | + |
| 91 | + sbom: |
| 92 | + if: github.ref == 'refs/heads/main' |
| 93 | + needs: [create-version, docker-build-push] |
| 94 | + uses: platform-mesh/.github/.github/workflows/job-sbom.yml@main |
| 95 | + with: |
| 96 | + imageReference: ghcr.io/platform-mesh/example-httpbin-operator:${{ needs.create-version.outputs.version }} |
| 97 | + |
| 98 | + image-ocm: |
| 99 | + if: github.ref == 'refs/heads/main' |
| 100 | + needs: [create-version, docker-build-push, sbom] |
| 101 | + uses: platform-mesh/.github/.github/workflows/job-image-ocm.yml@main |
| 102 | + secrets: inherit |
| 103 | + with: |
| 104 | + imageReference: ghcr.io/platform-mesh/example-httpbin-operator:${{ needs.create-version.outputs.version }} |
| 105 | + appVersion: ${{ needs.create-version.outputs.version }} |
| 106 | + repoName: example-httpbin-operator |
| 107 | + commit: ${{ github.sha }} |
0 commit comments