-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from asgrim/consolidate-release-pipelines
Use GH attestation and organise workflows better
- Loading branch information
Showing
7 changed files
with
103 additions
and
94 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Invoking this pipeline requires additional permissions, so must be invoked | ||
# in a way to pass those permissions on, e.g.: | ||
# | ||
# build-phar: | ||
# permissions: | ||
# contents: read | ||
# id-token: write | ||
# attestations: write | ||
# uses: ./.github/workflows/build-phar.yml | ||
|
||
name: "Build the PIE PHAR" | ||
|
||
on: | ||
workflow_call: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build-phar: | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: | ||
- ubuntu-latest | ||
php-versions: | ||
- '8.1' | ||
permissions: | ||
# id-token:write is required for build provenance attestation. | ||
id-token: write | ||
# attestations:write is required for build provenance attestation. | ||
attestations: write | ||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: none | ||
tools: composer, box | ||
php-version: "${{ matrix.php-version }}" | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
# Ensure some kind of previous tag exists, otherwise box fails | ||
- run: git describe --tags HEAD || git tag 0.0.0 | ||
- uses: ramsey/composer-install@v3 | ||
- name: Build PHAR | ||
run: box compile | ||
- name: Check the PHAR executes | ||
run: php pie.phar --version | ||
- name: Generate build provenance attestation | ||
# It does not make sense to do this for PR builds, nor do contributors | ||
# have permission to do. We can't write attestations to `php/pie` in an | ||
# unprivileged context, otherwise anyone could send a PR with malicious | ||
# code, which would store attestation that `php/pie` built the PHAR, and | ||
# it would look genuine. So this should NOT run for PR builds. | ||
if: github.event_name != 'pull_request' | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-path: '${{ github.workspace }}/pie.phar' | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: pie-${{ github.sha }}.phar | ||
path: pie.phar |
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
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
This file was deleted.
Oops, something went wrong.
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
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
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