|
| 1 | +# Copyright 2010 New Relic, 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 | +name: Build CI Image |
| 16 | + |
| 17 | +on: |
| 18 | + workflow_dispatch: # Allow manual trigger |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: ${{ github.ref || github.run_id }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +jobs: |
| 25 | + build: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v3 |
| 30 | + with: |
| 31 | + persist-credentials: false |
| 32 | + fetch-depth: 0 |
| 33 | + |
| 34 | + - name: Set up Docker Buildx |
| 35 | + id: buildx |
| 36 | + uses: docker/setup-buildx-action@v2 |
| 37 | + |
| 38 | + - name: Generate Docker Metadata (Tags and Labels) |
| 39 | + id: meta |
| 40 | + uses: docker/metadata-action@v4 |
| 41 | + with: |
| 42 | + images: ghcr.io/${{ github.repository }}-ci |
| 43 | + flavor: | |
| 44 | + prefix= |
| 45 | + suffix= |
| 46 | + latest=false |
| 47 | + tags: | |
| 48 | + type=raw,value=latest,enable={{is_default_branch}} |
| 49 | + type=schedule,pattern={{date 'YYYY-MM-DD'}} |
| 50 | + type=sha,format=short,prefix=sha- |
| 51 | + type=sha,format=long,prefix=sha- |
| 52 | +
|
| 53 | + - name: Login to GitHub Container Registry |
| 54 | + if: github.event_name != 'pull_request' |
| 55 | + uses: docker/login-action@v2 |
| 56 | + with: |
| 57 | + registry: ghcr.io |
| 58 | + username: ${{ github.repository_owner }} |
| 59 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + |
| 61 | + - name: Build and Publish Image |
| 62 | + uses: docker/build-push-action@v3 |
| 63 | + with: |
| 64 | + push: ${{ github.event_name != 'pull_request' }} |
| 65 | + context: .github/containers |
| 66 | + platforms: linux/amd64 |
| 67 | + tags: ${{ steps.meta.outputs.tags }} |
| 68 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments