k6 image build on workflow_dispatch by ShubhamTiwary914 #4
This file contains hidden or 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: Build K6 Image & push to dockerhub | |
| run-name: k6 image build on ${{ github.event_name }} by ${{ github.actor }} | |
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| paths: | |
| - 'services/k6/**' | |
| workflow_dispatch: | |
| jobs: | |
| build-k6: | |
| name: Push K6's Image to DockerHub | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: read | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v5 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USER }} | |
| password: ${{ secrets.DOCKERHUB_PASS }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: extractor | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ secrets.K6_IMAGE }} | |
| labels: | | |
| org.opencontainers.image.description=updated on $(date +'%Y-%m-%d') - K6 load testing tool to work with logcore-v2 project (makes MQTT calls to verne-broker) | |
| - name: Build and push Docker image | |
| id: push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./services/k6 | |
| file: ./services/k6/Dockerfile | |
| push: true | |
| tags: | | |
| ${{ secrets.K6_IMAGE }}:latest | |
| labels: ${{ steps.extractor.outputs.labels }} | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v3 | |
| with: | |
| subject-name: index.docker.io/${{ secrets.K6_IMAGE }} | |
| subject-digest: ${{ steps.push.outputs.digest }} | |
| push-to-registry: false | |