Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github-action: provenance generation #1143

Merged
merged 9 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: make -C packaging package
- name: package info
run: make -C packaging info
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: package
path: |
Expand Down
27 changes: 26 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
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
- uses: actions/download-artifact@v4
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
Loading