From f47b72d249122872b33f3f0b9accf0237f37ea74 Mon Sep 17 00:00:00 2001 From: Roy Razon Date: Tue, 12 Dec 2023 12:04:17 +0200 Subject: [PATCH] simplify more - replace npm install step with npx - replace preevy init with --profile url - add node-cache input --- README.md | 10 ++++++++-- action.yml | 19 +++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index a844dd2..7a41a5a 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,12 @@ Optional additional args to the `preevy up` command, see the full reference [her Optional path to the `docker-compose.yaml` file. If not provided, uses the working directory. If you have multiple docker compose files, you can add them as a comma seperated string like so `'docker-compose.yml,docker-compose.dev.yml'` +### `node-cache` + +*required*: `false` + +Node package manager used for caching. Supported values: npm, yarn, pnpm, or ''. [Details](https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data). Default: npm. + ## Outputs ### `urls-json` @@ -103,7 +109,7 @@ jobs: - uses: actions/checkout@v3 - - uses: livecycle/preevy-up-action@v2.0.0 + - uses: livecycle/preevy-up-action@v2.1.0 id: preevy with: # Create the profile using the `preevy init` command, see @@ -181,7 +187,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: livecycle/preevy-up-action@v2.0.0 + - uses: livecycle/preevy-up-action@v2.1.0 id: preevy_up with: # Create the profile using the `preevy init` command, see diff --git a/action.yml b/action.yml index 3f91a2f..53efab4 100644 --- a/action.yml +++ b/action.yml @@ -18,6 +18,10 @@ inputs: required: false description: "Version of Preevy to use. Defaults to latest." default: latest + node-cache: + required: false + description: "Node package manager used for caching. Supported values: npm, yarn, pnpm, or ''. See https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data" + default: npm outputs: urls-json: description: "The generated URLs of the preview environments create by Preevy, formatted as a JSON object" @@ -31,28 +35,19 @@ runs: - uses: actions/setup-node@v4 with: node-version: 18 - cache: npm - - - name: Install the Preevy CLI - shell: bash - run: npm i -g preevy@${{ inputs.version }} - - - name: Initialize Preevy - shell: bash - run: preevy init --from ${{ inputs.profile-url }} + cache: ${{ inputs.node-cache }} - name: Run Preevy shell: bash id: run_preevy run: | - file_opt="" if [[ ! -z "${{ inputs.docker-compose-yaml-paths }}" ]]; then - file_opt="-f ${{ inputs.docker-compose-yaml-paths }}" + opts="-f ${{ inputs.docker-compose-yaml-paths }}" fi urls_file=${RUNNER_TEMP}/preevy_urls.${RANDOM}.json - preevy up ${file_opt} --output-urls-to ${urls_file} ${{ inputs.args }} + npx -- preevy@${{ inputs.version }} up ${opts} --profile '${{ inputs.profile-url }}' --output-urls-to ${urls_file} ${{ inputs.args }} cat ${urls_file}