Add build attestations to docker image, and fix trigger to include do… #624
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Weaver Docker Generator | |
on: | |
push: | |
tags: [ '**' ] | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
paths: | |
- .github/workflows/publish-docker.yml | |
- 'src/**' | |
- 'crates/**' | |
- Dockerfile | |
env: | |
TEST_WEAVER_TAG: otel/weaver:test | |
jobs: | |
make-docker-image: | |
name: Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: otel/weaver | |
- name: Build test image | |
uses: docker/[email protected] | |
with: | |
push: false | |
load: true | |
tags: ${{ env.TEST_WEAVER_TAG }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Test | |
run: | | |
docker run --rm ${{ env.TEST_WEAVER_TAG }} --help | |
- name: Log in to Docker Hub | |
uses: docker/[email protected] | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/[email protected] | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
with: | |
push: true | |
provenance: mode=max | |
sbom: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |