Skip to content

Commit

Permalink
Enhancement: Add composite action for installing dependencies with phive
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Jan 24, 2023
1 parent 713f0c2 commit 28c070b
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,14 @@ updates:
package-ecosystem: "github-actions"
schedule:
interval: "daily"

- commit-message:
include: "scope"
prefix: "github-actions"
directory: "/actions/phive/install"
labels:
- "dependency"
open-pull-requests-limit: 10
package-ecosystem: "github-actions"
schedule:
interval: "daily"
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

For a full diff see [`1.7.0...main`][1.7.0...main].

### Added

- Added composite action `phive/install` for installing dependencies with [`phive`](https://phar.io) ([#124]), by [@localheinz]

## [`1.7.0`][1.7.0]

For a full diff see [`1.6.0...1.7.0`][1.6.0...1.7.0].
Expand Down
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This repository provides the following composite actions:
- [`ergebnis/.github/actions/oh-dear/check/request-run`](#oh-dear-check-request-run)
- [`ergebnis/.github/actions/oh-dear/maintenance-period/start`](#oh-dear-maintenance-period-start)
- [`ergebnis/.github/actions/oh-dear/maintenance-period/stop`](#oh-dear-maintenance-period-stop)
- [`ergebnis/.github/actions/phive/install`](#phive-install)

### <a name="composer-determine-cache-directory"> `ergebnis/.github/actions/composer/determine-cache-directory`

Expand Down Expand Up @@ -655,6 +656,63 @@ none

A maintenance period is stopped by the user who owns the Oh Dear API token specified with the `oh-dear-api-token` input for the site identified by the `oh-dear-site-id` input.

### <a name="phive-install"> `ergebnis/.github/actions/phive/install`

This action installs dependencies with [`phive`](https://phar.io).

```yaml
name: "Integrate"
on:
pull_request: null
push:
branches:
- "main"
jobs:
tests:
name: "Tests"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/[email protected]"
- name: "Set up PHP"
uses: "shivammathur/[email protected]"
with:
coverage: "none"
php-version: "8.1"
tools: "phive"
- name: "Install dependencies with phive"
uses: "ergebnis/.github/actions/phive/[email protected]"
with:
trust-gpg-keys: "0x033E5F8D801A2F8D,0x2A8299CE842DD38C"
```

For details, see [`actions/phive/install/action.yaml`](actions/phive/install/action.yaml).

#### Inputs

- `phive-home`, optional: Which directory to use as `PHIVE_HOME` directory, defaults to `".build/phive"`.
- `trust-gpg-keys`, required: Which GPG keys to trust, a comma-separated list of trusted GPG keys

#### Outputs

none

#### Side Effects

Dependencies are installed, assuming

- `phive` is available
- `phive` could find a `phars.xml`
- keys presented by packages are listed using the `trust-gpg-keys` option

The directory configured by the `phive-home` directory is cached using [`actions/cache`](https://github.com/actions/cache).

## Changelog

Please have a look at [`CHANGELOG.md`](CHANGELOG.md).
Expand Down
39 changes: 39 additions & 0 deletions actions/phive/install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions
# https://phar.io

name: "Install dependencies with phive"

description: "Installs dependencies with phive"

inputs:
phive-home:
default: ".build/phive"
description: "Which directory to use as PHIVE_HOME directory"
required: false
trust-gpg-keys:
default: ""
description: "A comma-separated list of trusted GPG keys"
required: true

runs:
using: "composite"

steps:
- name: "Create phive home directory"
run: "mkdir -p ${{ inputs.phive-home }}"
shell: "bash"

- name: "Cache dependencies installed with phive"
uses: "actions/[email protected]"
with:
path: "${{ inputs.phive-home }}"
key: "phive-hashFiles('**/phars.xml')"
restore-keys: "phive-"

- name: "Install dependencies with phive"
env:
PHIVE_HOME: "${{ inputs.phive-home }}"
run: "phive install --trust-gpg-keys ${{ inputs.trust-gpg-keys }}"
shell: "bash"

0 comments on commit 28c070b

Please sign in to comment.