https://github.com/freckle/setup-platform-action
GitHub Action to install the Freckle Platform CLI
https://github.com/freckle/setup-platform-action
ghvm-managed
Last synced: about 1 year ago
JSON representation
GitHub Action to install the Freckle Platform CLI
- Host: GitHub
- URL: https://github.com/freckle/setup-platform-action
- Owner: freckle
- License: mit
- Created: 2021-01-20T16:01:58.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-08T03:56:28.000Z (about 1 year ago)
- Last Synced: 2025-04-08T04:28:51.294Z (about 1 year ago)
- Topics: ghvm-managed
- Language: Shell
- Homepage:
- Size: 135 KB
- Stars: 0
- Watchers: 15
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Setup Platform Action
GitHub Action to install and configure our [PlatformCLI][platform] and
[Stackctl][] tools.
[platform]: https://github.com/freckle/platform
[stackctl]: https://github.com/freckle/stackctl
**NOTE**: This action is public so that we can use it outside of its own
repository, but the tooling it installs and uses is private. It is of no use
outside Freckle.
## Basic Usage
```yaml
- id: setup
uses: freckle/setup-platform-action@v7
with:
# Required
token: ${{ secrets.X }}
# Optional
# version: 3.2.2.2
# app-directory: my-app # If in multi-app repository
# environment: prod
# resource: my-resource # If in multi-resource app
# stackctl-version: 1.6.0.0
```
The action installs a `platform` executable, configures `PLATFORM_*` environment
variables (so you can just invoke it without global options throughout the
remainder of your workflow), and sets the `tag` output.
This can be used to build and push images,
```yaml
- run: platform container:login
- run: platform container:push --tag '${{ steps.setup.outputs.tag }}'
```
Build and push assets,
```yaml
- run: platform assets:push --tag '${{ steps.setup.outputs.tag }}'
```
Or deploy
```yaml
- run: platform deploy --tag '${{ steps.setup.outputs.tag }}'
```
We also export various `SLACK_*` environment variables, so you don't have to set
as much when notifying via the `rtCamp` action:
```yaml
- if: ${{ always() }}
uses: rtCamp/action-slack-notify@v2
env:
# Only this is now required
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
# But you probably want this too
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: ${{ job.status }}
```
## Stackctl
The action also installs a `stackctl` executable and configures `STACKCTL_*`
variables to work with the specifications generated by PlatformCLI. This means
you can do things like post changeset details to your PR:
```yaml
- run: |
# Generates content in .platform/specs
platform deploy --tag '${{ steps.prep.outputs.tag }}' --inspect
# Which you can work with naturally using Stackctl
stackctl changes --format pr /tmp/changes.md
- uses: { your preferred add-pr-comment action }
with:
body-path: /tmp/changes.md
```
## Inputs
| name | description | required | default |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ----------------- |
| `version` |
The version of PlatformCLI to install. Do not include the v prefix here. The default is to lookup the latest release. We recommend using this default, along with specifying a required_version constraint (such as =~ 3) in your .platform.yaml.
| `false` | `""` |
| `token` | A GitHub access token with rights to fetch the private PlatformCLI release artifacts. Either this or github-app-{id,private-key} must be given.
| `false` | `""` |
| `github-app-id` | Provide this (and github-private-key) instead of token to generate and use one from the identified App.
| `false` | `""` |
| `github-private-key` | Provide this (and github-app-id) instead of token to generate and use one from the identified App.
| `false` | `""` |
| `github-app-private-key` | Deprecated, use github-private-key
| `false` | `""` |
| `app-directory` | If present, this will be set as PLATFORM_APP_DIRECTORY for the remainder of the workflow. For details on what this affects, see platform(1).
| `false` | `""` |
| `environment` | If present, this will be set as PLATFORM_ENVIRONMENT for the remainder of the workflow. For details on what this affects, see platform(1).
| `false` | `""` |
| `resource` | If present, this will be set as PLATFORM_RESOURCE for the remainder of the workflow. For details on what this affects, see platform(1).
| `false` | `""` |
| `no-validate` | If present, this will be set as PLATFORM_NO_VALIDATE for the remainder of the workflow. For details on what this affects, see platform(1).
| `false` | `""` |
| `stackctl-version` | The version of Stackctl to install. Do not include the v prefix here. The default is to lookup the latest release.
| `false` | `""` |
| `stackctl-directory` | Value to set as STACKCTL_DIRECTORY
| `false` | `.platform/specs` |
| `stackctl-filter` | Value to set as STACKCTL_FILTER
| `false` | `""` |
| `fetch-platform-yaml` | Automatically fetch .platform.yaml via GitHub API if not present. This can be useful to avoid a checkout if all your Job needs is this file. This will always use github.token, regardless of our own token input.
| `false` | `true` |
## Outputs
| name | description |
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tag` |
A consistent, source-specific value that should be used throughout build/push/deploy actions. It's currently the head sha for pull_request events, the "after" sha for push events, and github.sha for all other events
|
| `cache` | Path to the .platform/cache directory, for which we've setup an actions/cache step. This output is only useful if in a multi-app repository.
|
## Usage
```yaml
- uses: freckle/platform-setup-action@v7
with:
version:
# The version of PlatformCLI to install. Do not include the `v` prefix here.
# The default is to lookup the latest release. We recommend using this
# default, along with specifying a `required_version` constraint (such as
# `=~ 3`) in your `.platform.yaml`.
#
# Required: false
# Default: ""
token:
# A GitHub access token with rights to fetch the private PlatformCLI release
# artifacts. Either this or `github-app-{id,private-key}` must be given.
#
# Required: false
# Default: ""
github-app-id:
# Provide this (and `github-private-key`) instead of `token` to generate
# and use one from the identified App.
#
# Required: false
# Default: ""
github-private-key:
# Provide this (and `github-app-id`) instead of `token` to generate and use
# one from the identified App.
#
# Required: false
# Default: ""
github-app-private-key:
# Deprecated, use github-private-key
#
# Required: false
# Default: ""
app-directory:
# If present, this will be set as `PLATFORM_APP_DIRECTORY` for the remainder
# of the workflow. For details on what this affects, see `platform(1)`.
#
# Required: false
# Default: ""
environment:
# If present, this will be set as `PLATFORM_ENVIRONMENT` for the remainder
# of the workflow. For details on what this affects, see `platform(1)`.
#
# Required: false
# Default: ""
resource:
# If present, this will be set as `PLATFORM_RESOURCE` for the remainder of
# the workflow. For details on what this affects, see `platform(1)`.
#
# Required: false
# Default: ""
no-validate:
# If present, this will be set as `PLATFORM_NO_VALIDATE` for the remainder
# of the workflow. For details on what this affects, see `platform(1)`.
#
# Required: false
# Default: ""
stackctl-version:
# The version of Stackctl to install. Do not include the `v` prefix here.
# The default is to lookup the latest release.
#
# Required: false
# Default: ""
stackctl-directory:
# Value to set as STACKCTL_DIRECTORY
#
# Required: false
# Default: .platform/specs
stackctl-filter:
# Value to set as STACKCTL_FILTER
#
# Required: false
# Default: ""
fetch-platform-yaml:
# Automatically fetch `.platform.yaml` via GitHub API if not present. This
# can be useful to avoid a checkout if all your Job needs is this file. This
# will always use `github.token`, regardless of our own `token` input.
#
# Required: false
# Default: true
```
## Caveat
Depending on the version of PlatformCLI you install, not all
environment-variable-based configurations may be supported. Please refer to the
documentation for the version you're using.
---
[LICENSE](./LICENSE)