Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: small updates to CI documentation #459

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions site/docs/ci/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: aws-actions/configure-aws-credentials@v2
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::12345678:role/my-role
aws-region: eu-west-1
Expand All @@ -111,15 +111,11 @@ jobs:
- uses: livecycle/[email protected]
id: preevy
with:
install: gh-release
profile-url: "${{ vars.PREEVY_PROFILE_URL }}"
docker-compose-yaml-paths: "./docker/docker-compose.yaml"

# Change `frontend` and `3000` in this step to your main service and port
# This will appear as the GH environment URL
- id: store_url
name: Store URL of frontend
run: |
echo url=$(jq -r '.[] | select(.service=="frontend" and .port==3000).url' "${{ steps.preevy_up.outputs.urls-file }}") >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ github.token }}
```

- For the `Teardown Preevy environment` workflow, create the file `preevy-down.yaml` in the `.github/workflows` directory of your repo:
Expand All @@ -140,7 +136,7 @@ jobs:
teardown:
runs-on: ubuntu-latest
steps:
- uses: aws-actions/configure-aws-credentials@v2
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::12345678:role/my-role
aws-region: eu-west-1
Expand All @@ -149,14 +145,35 @@ jobs:
- uses: livecycle/[email protected]
id: preevy
with:
install: gh-release
profile-url: "${{ vars.PREEVY_PROFILE_URL }}"
docker-compose-yaml-paths: "./docker/docker-compose.yaml"
env:
GITHUB_TOKEN: ${{ github.token }}
```

- Add a [GitHub action configuration variable](https://docs.github.com/en/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows) named `PREEVY_PROFILE_URL` and set the value to the URL printed at the `preevy init` output.
- Add a [GitHub action configuration variable](https://docs.github.com/en/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows) named `PREEVY_PROFILE_URL` and set the value to the URL printed at the `preevy init` (or `preevy profile ls`) output.

### 4. Get Automatic GitHub Notifications

You're all set! When you open a PR, Preevy will now build preview environments.
The [Preevy Github Plugin](/github-plugin) will automatically detect the GitHub context and post a comment on your PR with the links to each of the relevant services when they are available for review.
Teammates can simply click these links and preview your latest changes in their browsers.

## Examples

* [GitHub Actions + Google Kubernetes Engine + Kubernetes builder](https://github.com/livecycle/preevy-gha-gke-demo/tree/main/.github/workflows)
* [GitHub Actions + Google Cloud](https://github.com/livecycle/preevy-gha-gce-demo/tree/main/.github/workflows)

## Troubleshooting

### Enable debug logging

Add the `--debug` flag to the `args` parameter:

```yaml
- uses: livecycle/[email protected]
id: preevy
with:
args: "--debug"
```
Loading