Skip to content

Add GitHub Actions workflow to build self-contained release archives - #999

Merged
DavidGoodwin merged 4 commits into
postfixadmin:masterfrom
knofte:add-release-workflow
Apr 3, 2026
Merged

Add GitHub Actions workflow to build self-contained release archives#999
DavidGoodwin merged 4 commits into
postfixadmin:masterfrom
knofte:add-release-workflow

Conversation

@knofte

@knofte knofte commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #973

Adds a GitHub Actions workflow that automatically builds a self-contained .tar.gz release archive (with vendor/ included) whenever a release is published. This means admins can download and install PostfixAdmin without needing composer on the server.

How it works

  • Triggers on release: published events
  • Uses PHP 8.2 (minimum supported version) to run composer install --no-dev --optimize-autoloader
  • Packages everything into a .tar.gz, excluding development files (.git, .github, tests, etc.)
  • Uploads the archive as a release asset using gh release upload

Why PHP 8.2?

Building on the minimum supported PHP version ensures the resolved dependencies work on all supported versions (8.2, 8.3, 8.4, 8.5+). Composer resolves packages compatible with the running PHP version, and newer PHP versions are backwards compatible.

Test plan

  • Create a test release/tag to verify the workflow runs
  • Download the resulting .tar.gz and verify it contains vendor/ with all dependencies
  • Extract and run on PHP 8.2 and 8.4 to confirm it works without composer install

knofte added a commit to knofte/postfixadmin that referenced this pull request Mar 30, 2026
Adds an update-check page that queries the GitHub Releases API to show
available updates with changelogs, and allows global admins to download
and apply updates directly from the web UI.

Depends on postfixadmin#999 for self-contained release tarballs.
knofte added a commit to knofte/postfixadmin that referenced this pull request Mar 30, 2026
Adds an update-check page that queries the GitHub Releases API to show
available updates with changelogs, and allows global admins to download
and apply updates directly from the web UI.

Depends on postfixadmin#999 for self-contained release tarballs.
knofte added a commit to knofte/postfixadmin that referenced this pull request Mar 30, 2026
Adds an update-check page that queries the GitHub Releases API to show
available updates with changelogs, and allows global admins to download
and apply updates directly from the web UI.

Depends on postfixadmin#999 for self-contained release tarballs.
knofte added a commit to knofte/postfixadmin that referenced this pull request Mar 30, 2026
Adds an update-check page that queries the GitHub Releases API to show
available updates with changelogs, and allows global admins to download
and apply updates directly from the web UI.

Depends on postfixadmin#999 for self-contained release tarballs.
knofte added a commit to knofte/postfixadmin that referenced this pull request Mar 30, 2026
Adds an update-check page that queries the GitHub Releases API to show
available updates with changelogs, and allows global admins to download
and apply updates directly from the web UI.

Depends on postfixadmin#999 for self-contained release tarballs.
@knofte

knofte commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

Will rebase after PR #1001 is merged, and CI should pass nicely.

@jmontesse

Copy link
Copy Markdown

Is this written to effectively require PHP 8.2 and sqlite?

@DavidGoodwin

Copy link
Copy Markdown
Member

Is this written to effectively require PHP 8.2 and sqlite?

No, it'd be database independent. You'd need to configure config.local.php or whatever as usual.

It's just to save someone the hassle (?) of running composer to install libraries.

@knofte
knofte force-pushed the add-release-workflow branch from 0ea537e to 412dd3a Compare March 31, 2026 06:30
knofte added a commit to knofte/postfixadmin that referenced this pull request Mar 31, 2026
Adds an update-check page that queries the GitHub Releases API to show
available updates with changelogs, and allows global admins to download
and apply updates directly from the web UI.

Depends on postfixadmin#999 for self-contained release tarballs.
knofte added a commit to knofte/postfixadmin that referenced this pull request Mar 31, 2026
Adds an update-check page that queries the GitHub Releases API to show
available updates with changelogs, and allows global admins to download
and apply updates directly from the web UI.

Depends on postfixadmin#999 for self-contained release tarballs.
@knofte
knofte force-pushed the add-release-workflow branch from 412dd3a to 4078689 Compare March 31, 2026 06:45
@jmontesse

Copy link
Copy Markdown

Is this written to effectively require PHP 8.2 and sqlite?

No, it'd be database independent. You'd need to configure config.local.php or whatever as usual.

It's just to save someone the hassle (?) of running composer to install libraries.

No I get that. But in the release.yml file in the PR, there is "extensions: sqlite3, gd" (line 21) in the release.yml file. If the workflow is only to have composer roll a vendor dir for the release asset, I'm puzzled why the build env needs those extensions installed?

@knofte

knofte commented Mar 31, 2026

Copy link
Copy Markdown
Contributor Author

Good catch - removed the unnecessary extensions earlier from the workflow actually.

They're only "suggest" in composer.json and "composer install --no-dev" doesn't need them.

@DavidGoodwin

Copy link
Copy Markdown
Member

Is this written to effectively require PHP 8.2 and sqlite?

No, it'd be database independent. You'd need to configure config.local.php or whatever as usual.
It's just to save someone the hassle (?) of running composer to install libraries.

No I get that. But in the release.yml file in the PR, there is "extensions: sqlite3, gd" (line 21) in the release.yml file. If the workflow is only to have composer roll a vendor dir for the release asset, I'm puzzled why the build env needs those extensions installed?

The extensions in the github action ....

  • sqlite - so unit tests could run against an sqlite database.
  • gd is there for the TOTP stuff

…ostfixadmin#973)

Automatically builds a .tar.gz with vendor/ included when a release
is published, so admins can install without needing composer.
@knofte
knofte force-pushed the add-release-workflow branch from 4078689 to 922a473 Compare March 31, 2026 10:12
@knofte

knofte commented Mar 31, 2026

Copy link
Copy Markdown
Contributor Author

Restored the extensions and added a comment explaining their purpose. Thanks for clarifying David!

@knofte

knofte commented Mar 31, 2026

Copy link
Copy Markdown
Contributor Author

@DavidGoodwin I've added a comment about that in the file, as it will help in the future. (documentation for the win) :)

@DavidGoodwin

Copy link
Copy Markdown
Member

@DavidGoodwin I've added a comment about that in the file, as it will help in the future. (documentation for the win) :)

@knofte The comment you added in the github actions doesn't really add much.

The php extensions, that are listed within the github actions file, are there so the github actions initiated unit tests can run (SQLite was the easiest database to setup/use).

Yes, obviously this means there's a chance there is a bug in the MySQL or PostgreSQL support, but when I added the unit test/github action build, I thought getting something tested was better than nothing.

If I had time/motivation, I might instead have a docker-compose.yml file with PostgreSQL and MySQL services, and test against them "properly".

FWIW, It'd be easier to review your changes if you'd stop squashing and force pushing everything into one commit. Then (with the above comment, for example) anyone reviewing it can just look at the specific change you'd made.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a GitHub Actions workflow to build and upload a self-contained PostfixAdmin release .tar.gz (including vendor/) whenever a GitHub Release is published, enabling installations without needing Composer on the target server.

Changes:

  • New release: published workflow that installs production dependencies on PHP 8.2.
  • Creates a release tarball with exclusions for development-only files/directories.
  • Uploads the generated archive to the GitHub Release as an asset via gh release upload.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml Outdated
@knofte

knofte commented Mar 31, 2026

Copy link
Copy Markdown
Contributor Author

Good point on the squashing, will keep separate commits going forward, sorry about that.

On the docker-compose/testing idea, happy to put together a PR for that. I'd suggest extending the existing php.yml with MySQL and PostgreSQL service containers rather than a separate workflow, since the test infrastructure is already there. I'll add phpstan too - only 5 errors at level 0 on the current codebase, so it's a clean starting point to build from.

@knofte

knofte commented Mar 31, 2026

Copy link
Copy Markdown
Contributor Author

Also put together PR #1005 which adds phpstan (level 0, 5 existing errors fixed) and MySQL + PostgreSQL test jobs to CI. The test bootstrap already had all three database backends wired up, just needed the CI service containers.

@jmontesse

Copy link
Copy Markdown

The php extensions, that are listed within the github actions file, are there so the github actions initiated unit tests can run (SQLite was the easiest database to setup/use).

Isn't that Action just to package the release tarball? Unit testing should have already been done at that point.

@DavidGoodwin

Copy link
Copy Markdown
Member

The php extensions, that are listed within the github actions file, are there so the github actions initiated unit tests can run (SQLite was the easiest database to setup/use).

Isn't that Action just to package the release tarball? Unit testing should have already been done at that point.

Yes, good point. The extensions aren't needed in this context / yml file.

@knofte
knofte requested a review from DavidGoodwin March 31, 2026 20:36
@DavidGoodwin

Copy link
Copy Markdown
Member

(yes, I see you've asked me to review it; visually it look sfine. I was wondering how to test it without doing it under postfixadmin/postfixadmin .... )

@knofte

knofte commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

Updated the archive name to include the PHP version, e.g. postfixadmin-v4.0.2-php82.tar.gz.

Single tarball built on PHP 8.2 (minimum supported). As you say, if someone hits issues on a newer PHP they can run composer update to resolve.

@knofte

knofte commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

Tested the workflow on our fork - works as expected:

https://github.com/knofte/postfixadmin/releases/tag/v4.0.2-test

  • Tarball: postfixadmin-v4.0.2-test-php82.tar.gz (26 MB)
  • vendor/ included (4,397 files)
  • Exclusions working: no .github, tests/, debian/, .php-cs-fixer*, phpunit.xml, psalm.xml
  • Files extract into postfixadmin-v4.0.2-test-php82/ directory

@knofte

knofte commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

And the build-action here - https://github.com/knofte/postfixadmin/actions/runs/23854475761 :)

@DavidGoodwin
DavidGoodwin merged commit 225a55d into postfixadmin:master Apr 3, 2026
DavidGoodwin pushed a commit that referenced this pull request Jun 16, 2026
…999)

* Add GitHub Actions workflow to build self-contained release archives (#973)

Automatically builds a .tar.gz with vendor/ included when a release is published, this saves users from needing to use composer etc. Currently a single file, built for a PHP 8.2 environment. 

Thanks @knofte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please provide complete/self-contained release downloads

4 participants