|
| 1 | +# Copyright 2025 Cockroach Labs, Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | + |
| 16 | +name: Docker |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | +on: |
| 20 | + push: |
| 21 | + tags: [ 'v*.*.*' ] |
| 22 | + # PR's will trigger an image build, but the push action is disabled. |
| 23 | + pull_request: |
| 24 | + workflow_dispatch: |
| 25 | + inputs: |
| 26 | + build_binaries: |
| 27 | + description: 'Docker' |
| 28 | + type: boolean |
| 29 | + required: false |
| 30 | +jobs: |
| 31 | + docker: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + permissions: |
| 34 | + contents: read |
| 35 | + packages: write |
| 36 | + attestations: write |
| 37 | + id-token: write |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@v4 |
| 41 | + - name: Set up QEMU |
| 42 | + uses: docker/setup-qemu-action@v3 |
| 43 | + - name: Set up Docker Buildx |
| 44 | + uses: docker/setup-buildx-action@v3 |
| 45 | + - name: Login to ghcr.io |
| 46 | + if: github.event_name != 'pull_request' |
| 47 | + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 |
| 48 | + with: |
| 49 | + registry: ghcr.io |
| 50 | + username: ${{ github.actor }} |
| 51 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + - name: Docker meta |
| 53 | + id: meta |
| 54 | + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 |
| 55 | + with: |
| 56 | + images: ghcr.io/${{ github.repository }} |
| 57 | + tags: | |
| 58 | + type=ref,event=branch |
| 59 | + type=ref,event=tag |
| 60 | + type=sha |
| 61 | + labels: | |
| 62 | + org.opencontainers.image.title=Blobcheck |
| 63 | + org.opencontainers.image.vendor=Cockroach Labs Inc. |
| 64 | + org.opencontainers.image.descripton=Prototype, not officially supported |
| 65 | + - name: Build and push |
| 66 | + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 |
| 67 | + with: |
| 68 | + context: . |
| 69 | + platforms: linux/amd64,linux/arm64 |
| 70 | + push: ${{ github.event_name != 'pull_request' }} |
| 71 | + tags: ${{ steps.meta.outputs.tags }} |
| 72 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments