Skip to content

Commit

Permalink
feat: add action to install phive dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed Mar 29, 2024
1 parent ddcc034 commit 072115b
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: fix-encoding-pragma

- repo: https://github.com/commitizen-tools/commitizen
rev: 3.5.3
rev: v3.20.0
hooks:
- id: commitizen
stages:
- commit-msg

- repo: https://github.com/mpalmer/action-validator
rev: v0.5.3
rev: v0.6.0
hooks:
- id: action-validator
stages:
Expand Down
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This repository is a collection of reusable GitHub Actions workflows and composi
Learn more about:

- [Reusing Workflows](https://docs.github.com/en/actions/using-workflows/reusing-workflows)
- [Creating Composite Actions](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action)
- [Creating Composite Actions](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action)

<br>

Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:

<br>

#### `create-release.yml:`
#### `create-release.yml:`

This workflow uses [google-github-actions/release-please-action](https://github.com/google-github-actions/release-please-action) to create automated releases based on [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).

Expand Down Expand Up @@ -347,7 +347,7 @@ Composite Actions are a powerful feature of GitHub Actions that allow you to cre

#### `composer/install:`

This action installs dependencies with Composer based on the specified dependency level (`lowest`, `locked`, `highest`). It's designed to be flexible, allowing you to specify the working directory for the Composer command.
This action installs dependencies with Composer based on the specified dependency level (`lowest`, `locked`, `highest`). It's designed to be flexible, allowing you to specify the working directory for the Composer command.

Here is an example of how to use this action in your existing workfow:

Expand Down Expand Up @@ -454,6 +454,38 @@ jobs:

<br>

#### `phive/install:`

This action installs dependencies with [Phive](https://github.com/phar-io/phive), the [Phar Installer](https://phar.io), based on the specified `PHIVE_HOME` directory and a list of trusted `GPG keys`. It's designed to be flexible, allowing you to specify the `PHIVE_HOME directory` and the `GPG keys` to trust for the installation process.

Here is an example of how to use this action in your existing workflow:

```yaml
---
on:
push:
branches:
- master
pull_request:
name: 📥 Phive Install
jobs:
phive-install:
runs-on: ubuntu-latest
steps:
- name: 📦 Check out the codebase
uses: actions/checkout@v4
- name: 📥 Install dependencies with Phive
uses: wayofdev/gh-actions/actions/phive/install@master
with:
phive-home: '.build/phive'
trust-gpg-keys: '0x033E5F8D801A2F8D'
```

## 🤝 License

[![Licence](https://img.shields.io/github/license/wayofdev/gh-actions?style=for-the-badge&color=blue)](./LICENSE)
Expand Down
41 changes: 41 additions & 0 deletions actions/phive/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Documentation References:
# - Creating a Composite Action: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
# - Metadata Syntax for Inputs: https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
# - Runs for Composite Actions: https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions
# - Phar documentation: https://phar.io
# - Other Implementations: https://github.com/ergebnis/.github/blob/main/actions

name: 📥 Phive install

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/cache@v4.0.2
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 072115b

Please sign in to comment.