|
1 | 1 | name: ci
|
2 | 2 | on:
|
3 | 3 | push:
|
4 |
| - branches: [main] |
| 4 | + branches: [ main ] |
| 5 | + tags: [ '*' ] |
5 | 6 | pull_request:
|
6 | 7 |
|
7 | 8 | permissions:
|
|
18 | 19 | with:
|
19 | 20 | go-version: '1.25'
|
20 | 21 | check-latest: true
|
| 22 | + cache: ${{ github.event_name != 'push' }} # zizmor: ignore[cache-poisoning] Zizmor doesn't understand that this disables caching for release builds |
21 | 23 | - run: make rollout-operator
|
22 | 24 |
|
23 | 25 | test:
|
|
30 | 32 | with:
|
31 | 33 | go-version: '1.25'
|
32 | 34 | check-latest: true
|
| 35 | + cache: ${{ github.event_name != 'push' }} # zizmor: ignore[cache-poisoning] Zizmor doesn't understand that this disables caching for release builds |
33 | 36 | - run: make test
|
34 | 37 | - run: make test-boringcrypto
|
35 | 38 |
|
|
43 | 46 | with:
|
44 | 47 | go-version: '1.25'
|
45 | 48 | check-latest: true
|
| 49 | + cache: ${{ github.event_name != 'push' }} # zizmor: ignore[cache-poisoning] Zizmor doesn't understand that this disables caching for release builds |
46 | 50 | - run: make build-image
|
47 | 51 | - run: make integration
|
48 | 52 |
|
|
56 | 60 | with:
|
57 | 61 | go-version: '1.25'
|
58 | 62 | check-latest: true
|
| 63 | + cache: ${{ github.event_name != 'push' }} # zizmor: ignore[cache-poisoning] Zizmor doesn't understand that this disables caching for release builds |
59 | 64 | - run: make build-image-boringcrypto
|
60 | 65 | - run: make integration
|
61 | 66 |
|
|
69 | 74 | with:
|
70 | 75 | go-version: '1.25'
|
71 | 76 | check-latest: true
|
| 77 | + cache: ${{ github.event_name != 'push' }} # zizmor: ignore[cache-poisoning] Zizmor doesn't understand that this disables caching for release builds |
72 | 78 | - uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8
|
73 | 79 | with:
|
74 | 80 | version: v2.4.0
|
75 | 81 | args: --timeout=5m
|
| 82 | + |
| 83 | + push-image: |
| 84 | + runs-on: ubuntu-latest |
| 85 | + needs: |
| 86 | + - build |
| 87 | + - test |
| 88 | + - integration |
| 89 | + - integration-boringcrypto |
| 90 | + - lint |
| 91 | + if: github.event_name == 'push' # We want this job to run for both pushes to main, as well as new tags. |
| 92 | + permissions: |
| 93 | + contents: write # Needed to be able to create releases. |
| 94 | + id-token: write |
| 95 | + steps: |
| 96 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 97 | + with: |
| 98 | + persist-credentials: false |
| 99 | + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5 |
| 100 | + with: |
| 101 | + go-version: '1.25' |
| 102 | + check-latest: true |
| 103 | + cache: false |
| 104 | + - name: Log in to Docker Hub |
| 105 | + uses: grafana/shared-workflows/actions/dockerhub-login@c6d954f7cd9c0022018982e01268de6cb75b913c # dockerhub-login/v1.0.2 |
| 106 | + - name: Generate image tag |
| 107 | + id: image_tag |
| 108 | + run: | |
| 109 | + if [[ "$REF_TYPE" == "tag" ]]; then |
| 110 | + echo "tag=$REF_NAME" >> "$GITHUB_OUTPUT" |
| 111 | + else |
| 112 | + echo "tag=main-$SHA" >> "$GITHUB_OUTPUT" |
| 113 | + fi |
| 114 | + env: |
| 115 | + REF_TYPE: ${{ github.ref_type }} |
| 116 | + REF_NAME: ${{ github.ref_name }} |
| 117 | + SHA: ${{ github.sha }} |
| 118 | + - name: Build and push image |
| 119 | + run: make publish-images |
| 120 | + env: |
| 121 | + IMAGE_TAG: ${{ steps.image_tag.outputs.tag }} |
| 122 | + - name: Publish release |
| 123 | + if: github.ref_type == 'tag' |
| 124 | + run: make release-notes | gh release create "$IMAGE_TAG" --notes-file - |
| 125 | + env: |
| 126 | + IMAGE_TAG: ${{ steps.image_tag.outputs.tag }} |
0 commit comments