flarum / framework

Simple forum software for building great communities.
http://flarum.org/
6.29k stars 832 forks source link

[1.x] feat: support passing of composer_auth to the reusable workflows and environment #3960

Closed imorland closed 8 months ago

imorland commented 8 months ago

Related to [X} which adds the same for the 2.x branch

Sometimes it is necessary to use private packagist, extiverse or such to retrieve composer packages for use in CI/CD tests. This PR allows setting of the COMPOSER_AUTH environment variable from an extension's workflow file.

For example:

name: Extension PHP

on: [workflow_dispatch, push, pull_request]

jobs:
  run:
    uses: flarum/framework/.github/workflows/REUSABLE_backend.yml@1.x
    with:
      enable_backend_testing: true
      enable_phpstan: true
      php_versions: '["8.1", "8.2", "8.3"]'

      backend_directory: .

    secrets:
      composer_auth: '{"bearer":{"extiverse.com": "${{secrets.EXTIVERSE_COMPOSER_TOKEN}}"}}'

This allows us to pass the Bearer JSON array, and therefore covers cases where multiple secrets are required. Extiverse example shown.

imorland commented 8 months ago

Closing as direct pushing to 1.x