|
| 1 | +name: Build Common Files |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +env: |
| 12 | + IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} |
| 13 | + IMAGE_NAME: bluefin-common |
| 14 | + |
| 15 | +jobs: |
| 16 | + build_push: |
| 17 | + name: Build and push image |
| 18 | + runs-on: ubuntu-24.04 |
| 19 | + permissions: |
| 20 | + contents: read |
| 21 | + packages: write |
| 22 | + id-token: write |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 |
| 27 | + |
| 28 | + - name: Lowercase Registry |
| 29 | + id: registry_case |
| 30 | + uses: ASzc/change-string-case-action@d0603cd0a7dd490be678164909f65c7737470a7f # v6 |
| 31 | + with: |
| 32 | + string: ${{ env.IMAGE_REGISTRY }} |
| 33 | + |
| 34 | + - name: Generate Image Metadata |
| 35 | + uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5 |
| 36 | + id: meta |
| 37 | + with: |
| 38 | + images: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }} |
| 39 | + tags: | |
| 40 | + type=raw,value=latest |
| 41 | +
|
| 42 | + - name: Login to GitHub Container Registry |
| 43 | + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 |
| 44 | + if: github.event_name != 'pull_request' |
| 45 | + with: |
| 46 | + registry: ghcr.io |
| 47 | + username: ${{ github.actor }} |
| 48 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + |
| 50 | + - name: Build and Push Image |
| 51 | + uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5 |
| 52 | + id: build |
| 53 | + with: |
| 54 | + context: . |
| 55 | + file: ./Containerfile |
| 56 | + push: ${{ github.event_name != 'pull_request' }} |
| 57 | + tags: ${{ steps.meta.outputs.tags }} |
| 58 | + labels: ${{ steps.meta.outputs.labels }} |
| 59 | + |
| 60 | + # - name: Install Cosign |
| 61 | + # uses: sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1 |
| 62 | + # if: github.event_name != 'pull_request' |
| 63 | + |
| 64 | + # - name: Sign container image |
| 65 | + # if: github.event_name != 'pull_request' |
| 66 | + # run: | |
| 67 | + # cosign sign -y --key env://COSIGN_PRIVATE_KEY ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }} |
| 68 | + # env: |
| 69 | + # COSIGN_EXPERIMENTAL: false |
| 70 | + # COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }} |
0 commit comments