Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions .github/docs/templates/online.twig
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,21 @@

<ul class="nav nav-pills" id="docs-side-nav">
{% for page in pages %}
{% if page.slug != 'pie-maintainers-handbook' %}
<li class="nav-item"><a href="#docs/{{ page.slug }}" class="nav-link fragmentRoute">{{ page.title }}</a></li>
{% endif %}
{% endfor %}
</ul>
</header>
</div>

<section id="docs" class="tab-content"><div id="docs-content">
{% for page in pages %}
{% if page.slug != 'pie-maintainers-handbook' %}
<section id="docs/{{ page.slug }}" class="container my-md-4 bd-layout hidden">
{{ page.content|preg_replace('~\./docs/~', '')|raw }}
</section>
{% endif %}
{% endfor %}
</div></section>

Expand Down
46 changes: 36 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "Publish the PHAR for Releases"
name: "Publish a draft release with PHAR attached"

on:
release:
types:
- published
push:
tags:
- '*'

permissions:
contents: read
Expand All @@ -17,10 +17,32 @@ jobs:
attestations: write
uses: ./.github/workflows/build-phar.yml

release-phar:
create-draft-release:
runs-on: ubuntu-latest
needs:
- build-phar
permissions:
# contents:write is required to create the draft release
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-tags: 'true'
ref: ${{ github.ref }}
# The changelog is generated locally using jwage/changelog-generator and
# that forms the signed tag body. The `--notes-from-tag` option below
# will copy the release notes from the tag so it will contain the changelog
# Note we must create a *draft* release first, to allow attaching assets
# before the release is finalised when using immutable releases.
- name: Create draft release from tag
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "${{ github.ref_name }}" --title "${{ github.ref_name }}" --draft --notes-from-tag

release-phar:
runs-on: ubuntu-latest
needs:
- create-draft-release
permissions:
# contents:write is required to upload the binaries to the release.
contents: write
Expand All @@ -33,11 +55,15 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: gh attestation verify pie.phar --repo ${{ github.repository }}
- name: Upload binaries to release
uses: softprops/action-gh-release@v2
if: ${{startsWith(github.ref, 'refs/tags/') }}
with:
files: pie.phar
# Once the PHAR has been attached to the release, it is ready for review
# before publishing it. Note that if immutable releases are enabled,
# the tag, pre-release/latest release flag, and all assets become
# immutable, so checking this over is a manual exercise.
# More info: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases
- name: Attach an asset to the draft release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ github.ref_name }}" "pie.phar" --clobber

build-and-push-docker-image:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ box.json
box.phar
pie.phar
/docs-package/
CHANGELOG-*.md
64 changes: 64 additions & 0 deletions docs/pie-maintainers-handbook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: PIE Maintainers Handbook
order: 3
---
# PIE Maintainers Handbook

## Branching strategy

At the moment, we operate a single `main` branch, and feature branches. In the
future, to better facilitate patch versions, we may switch to a versioned
branching strategy.

## Release process

Make sure you have the latest version to be released, for example, one of:

```shell
# Using git reset (note: discards any local commits on `main`)
git checkout main && git fetch upstream && git reset --hard upstream/main
# or, using git pull (use `--ff-only` to avoid making merge commits)
git checkout main && git pull --ff-only upstream main
```

Prepare a changelog, set the version and milestone to be released, e.g.:

```shell
PIE_VERSION=1.3.0
PIE_MILESTONE=$PIE_VERSION
```

> [!TIP]
> For pre-releases, you can set the version/milestone to be different, e.g.:
>
> ```shell
> PIE_VERSION=1.3.0-alpha.2
> PIE_MILESTONE=1.3.0
> ```
>
> This will tag/release with the `1.3.0-alpha.2` version, but will generate the
> changelog based on the `1.3.0` milestone in GitHub.

Then generate the changelog file:

```shell
composer require --dev -W jwage/changelog-generator --no-interaction
vendor/bin/changelog-generator generate --user=php --repository=pie --milestone=$PIE_MILESTONE > CHANGELOG-$PIE_VERSION.md
git checkout -- composer.*
composer install
```

Check you are happy with the contents of the changelog. Create a signed tag:

```shell
git tag -s $PIE_VERSION -F CHANGELOG-$PIE_VERSION.md
git push upstream $PIE_VERSION
```

The release pipeline will run, which will create a **draft** release, build the
PHAR file, and attach it. You must then go to the draft release on GitHub,
verify everything is correct, and publish the release.

```shell
rm CHANGELOG-$PIE_VERSION.md
```