|
| 1 | +name: "Publish php Newrelic-Instrumentation" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - 'autoinstrumentation/php/**' |
| 7 | + - '.github/workflows/publish-newrelic-instrumentation-php.yaml' |
| 8 | + branches: |
| 9 | + - main |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - 'autoinstrumentation/php/**' |
| 13 | + - '.github/workflows/publish-newrelic-instrumentation-php.yaml' |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +jobs: |
| 17 | + publish: |
| 18 | + runs-on: ubuntu-20.04 |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v3 |
| 22 | + |
| 23 | + - name: Read version |
| 24 | + run: echo "VERSION=$(cat autoinstrumentation/php/version.txt)" >> $GITHUB_ENV |
| 25 | + |
| 26 | + - name: Docker meta |
| 27 | + id: meta |
| 28 | + uses: docker/metadata-action@v4 |
| 29 | + with: |
| 30 | + images: ghcr.io/${{ github.repository_owner }}/newrelic-agent-operator/instrumentation-php |
| 31 | + tags: | |
| 32 | + type=match,pattern=v(.*),group=1,value=v${{ env.VERSION }} |
| 33 | +
|
| 34 | + - name: Set up QEMU |
| 35 | + uses: docker/setup-qemu-action@v2 |
| 36 | + |
| 37 | + - name: Set up Docker Buildx |
| 38 | + uses: docker/setup-buildx-action@v2 |
| 39 | + |
| 40 | + - name: Cache Docker layers |
| 41 | + uses: actions/cache@v3 |
| 42 | + with: |
| 43 | + path: /tmp/.buildx-cache |
| 44 | + key: ${{ runner.os }}-buildx-${{ github.sha }} |
| 45 | + restore-keys: | |
| 46 | + ${{ runner.os }}-buildx- |
| 47 | +
|
| 48 | + - name: Login to GitHub Package Registry |
| 49 | + uses: docker/login-action@v2 |
| 50 | + with: |
| 51 | + registry: ghcr.io |
| 52 | + username: ${{ github.repository_owner }} |
| 53 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + |
| 55 | + - name: Build and push |
| 56 | + uses: docker/build-push-action@v4 |
| 57 | + with: |
| 58 | + context: autoinstrumentation/php |
| 59 | + platforms: linux/amd64,linux/arm64 |
| 60 | + push: true |
| 61 | + build-args: version=${{ env.VERSION }} |
| 62 | + tags: ${{ steps.meta.outputs.tags }} |
| 63 | + labels: ${{ steps.meta.outputs.labels }} |
| 64 | + cache-from: type=local,src=/tmp/.buildx-cache |
| 65 | + cache-to: type=local,dest=/tmp/.buildx-cache |
0 commit comments