Skip to content

Commit

Permalink
github-action: provenance generation (#1143)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v committed Apr 29, 2024
1 parent 627a3db commit 1d68a37
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Expand Up @@ -7,6 +7,8 @@ permissions:
on:
push:
tags: [ "v[0-9]+*" ]
branches:
- main

env:
BUILD_PACKAGES: build/packages
Expand All @@ -15,6 +17,7 @@ jobs:

release-started:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
with:
Expand All @@ -29,6 +32,9 @@ jobs:
uses: ./.github/workflows/build.yml

build-packages:
permissions:
contents: read
packages: read
needs:
- build
uses: ./.github/workflows/build-packages.yml
Expand All @@ -39,13 +45,22 @@ jobs:
- build-packages
env:
BUCKET_NAME: "apm-agent-php"
permissions:
attestations: write
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: package
path: ${{ env.BUILD_PACKAGES }}

- name: generate build provenance
uses: github-early-access/generate-build-provenance@main
with:
subject-path: "${{ github.workspace }}/${{ env.BUILD_PACKAGES }}/*"

## NOTE: The name of the zip should match the name of the folder to be zipped.
- name: Prepare packages to be signed
run: zip -r packages.zip packages/
Expand Down Expand Up @@ -74,6 +89,7 @@ jobs:
predefinedAcl: "publicRead"

- id: buildkite
if: startsWith(github.ref, 'refs/tags')
name: Run buildkite pipeline
uses: elastic/apm-pipeline-library/.github/actions/buildkite@current
with:
Expand All @@ -90,12 +106,17 @@ jobs:
BUNDLE_URL=https://storage.googleapis.com/${{ env.BUCKET_NAME }}/${{ steps.upload-file.outputs.uploaded }}
generate-test-packages-matrix:
if: startsWith(github.ref, 'refs/tags')
uses: ./.github/workflows/generate-matrix.yml

test-packages:
if: startsWith(github.ref, 'refs/tags')
needs:
- sign
- generate-test-packages-matrix
permissions:
contents: read
packages: read
uses: ./.github/workflows/test-packages.yml
with:
include: ${{ needs.generate-test-packages-matrix.outputs.include }}
Expand Down Expand Up @@ -126,12 +147,15 @@ jobs:
PACKAGE_FILE: "signed-artifacts.zip"

- name: Create draft release
if: startsWith(github.ref, 'refs/tags')
run: make -f .ci/Makefile draft-release

- name: Verify draft release
if: startsWith(github.ref, 'refs/tags')
run: ORIGINAL_PACKAGES_LOCATION=${{ env.BUILD_PACKAGES }} make -f .ci/Makefile download-verify

- name: Publish release
if: startsWith(github.ref, 'refs/tags')
run: make -f .ci/Makefile github-release-ready

notify:
Expand All @@ -150,6 +174,7 @@ jobs:
with:
needs: ${{ toJSON(needs) }}
- uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current
if: startsWith(github.ref, 'refs/tags')
with:
status: ${{ steps.check.outputs.status }}
vaultUrl: ${{ secrets.VAULT_ADDR }}
Expand Down

0 comments on commit 1d68a37

Please sign in to comment.