Skip to content

Commit

Permalink
simplify more
Browse files Browse the repository at this point in the history
- replace npm install step with npx
- replace preevy init with --profile url
- add node-cache input
  • Loading branch information
Roy Razon committed Dec 12, 2023
1 parent 36a45e1 commit f47b72d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 7 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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}
Expand Down

0 comments on commit f47b72d

Please sign in to comment.