Skip to content

Build Flarum Install Packages #44

Build Flarum Install Packages

Build Flarum Install Packages #44

Workflow file for this run

# The name is used in flarum/framework/.github/workflows/prepare-release.yml
name: Build Flarum Install Packages
on:
workflow_dispatch:
inputs:
flarum_version:
description: 'Flarum Version'
required: true
type: string
php_versions:
description: 'PHP Versions'
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
strategy:
# Each matrix job commits + pushes to `main` at the end of `build.sh`. If
# they run in parallel, all but the first push will be rejected with
# `cannot lock ref 'refs/heads/main'` because the remote has moved. Serialize.
max-parallel: 1
matrix:
bundle:
# Bundle with no package manager.
# Not needed for now. Those who do not wish to use the package manager, may install from the CLI.
# - name: default
# value: default
# Bundle with the extension manager.
- name: ''
value: flarum/extension-manager
# A bundle with the extension manager and no public directory/path (mostly for shared hosting).
- name: no-public-dir
value: flarum/extension-manager
name: Build Flarum ${{ inputs.flarum_version }} - ${{ matrix.bundle.name }} Bundle - PHP ${{ inputs.php_versions }}
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: xdebug
extensions: curl, dom, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip
tools: composer:v2
- name: Run Build Script
run: bin/build.sh
env:
FLARUM_VERSION: ${{ inputs.flarum_version }}
PHP_VERSIONS: ${{ inputs.php_versions }}
BUNDLE_NAME: ${{ matrix.bundle.name }}
BUNDLE_VALUE: ${{ matrix.bundle.value }}
# After all packages for this version are built and committed, open a PR to
# flarum/docs updating the install.md download table to point at them.
docs-pr:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out installation-packages (for the built files + generator)
uses: actions/checkout@v4
with:
# Check out the ref the workflow ran on: the `build` job committed the
# freshly-built packages to it, and it carries the generator script.
ref: ${{ github.ref }}
- name: Derive version paths
id: vars
run: |
FULL="v${FLARUM_VERSION#v}"
MAJOR="${FULL#v}"; MAJOR="${MAJOR%%.*}.x"
echo "full=$FULL" >> "$GITHUB_OUTPUT"
echo "major=$MAJOR" >> "$GITHUB_OUTPUT"
echo "packages_dir=packages/v$MAJOR/$FULL" >> "$GITHUB_OUTPUT"
# 2.x is the current (unversioned) docs; older majors are versioned.
if [ "$MAJOR" = "2.x" ]; then
echo "install_md=docs/install.md" >> "$GITHUB_OUTPUT"
else
echo "install_md=versioned_docs/version-$MAJOR/install.md" >> "$GITHUB_OUTPUT"
fi
env:
FLARUM_VERSION: ${{ inputs.flarum_version }}
# Mint a short-lived token from the flarum GitHub App so we can open a PR
# in the separate flarum/docs repo. Requires the DOCS_APP_ID and
# DOCS_APP_PRIVATE_KEY secrets (App scoped to flarum/docs +
# installation-packages with Contents + Pull requests write).
- name: Generate docs App token
id: docs-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.DOCS_APP_ID }}
private-key: ${{ secrets.DOCS_APP_PRIVATE_KEY }}
owner: flarum
repositories: docs
- name: Check out flarum/docs
uses: actions/checkout@v4
with:
repository: flarum/docs
token: ${{ steps.docs-token.outputs.token }}
path: docs-repo
- name: Regenerate the download table
run: |
FLARUM_VERSION='${{ inputs.flarum_version }}' \
PACKAGES_DIR='${{ steps.vars.outputs.packages_dir }}' \
INSTALL_MD='docs-repo/${{ steps.vars.outputs.install_md }}' \
bin/update-docs-table.sh
- name: Open PR to flarum/docs
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.docs-token.outputs.token }}
path: docs-repo
branch: update-install-links-${{ steps.vars.outputs.full }}
base: main
commit-message: "Update ${{ steps.vars.outputs.major }} install download links for ${{ steps.vars.outputs.full }}"
title: "Update ${{ steps.vars.outputs.major }} install download links for ${{ steps.vars.outputs.full }}"
body: |
Updates the install archive download table for **${{ steps.vars.outputs.major }}** to point at the newly built packages for `${{ steps.vars.outputs.full }}`.
Generated automatically by the `flarum/installation-packages` build workflow.
# No auto-merge — leave for manual review.
delete-branch: true