diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3696b79..9d2b7ed 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ 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 @@ -10,14 +10,14 @@ repos: - 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: diff --git a/README.md b/README.md index 77bdb4a..71e3549 100644 --- a/README.md +++ b/README.md @@ -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)
@@ -119,7 +119,7 @@ jobs:
-#### `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/). @@ -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: @@ -454,6 +454,38 @@ jobs:
+#### `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) diff --git a/actions/phive/install/action.yml b/actions/phive/install/action.yml new file mode 100644 index 0000000..45d964e --- /dev/null +++ b/actions/phive/install/action.yml @@ -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