GitHub Action to install and configure our PlatformCLI and Stackctl tools.
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.
- 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,
- run: platform container:login
- run: platform container:push --tag '${{ steps.setup.outputs.tag }}'
Build and push assets,
- run: platform assets:push --tag '${{ steps.setup.outputs.tag }}'
Or deploy
- 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:
- 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 }}
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:
- 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
name | description | required | default |
---|---|---|---|
version |
The version of PlatformCLI to install. Do not include the |
false |
"" |
token |
A GitHub access token with rights to fetch the private PlatformCLI release artifacts. Either this or |
false |
"" |
github-app-id |
Provide this (and |
false |
"" |
github-private-key |
Provide this (and |
false |
"" |
github-app-private-key |
Deprecated, use github-private-key |
false |
"" |
app-directory |
If present, this will be set as |
false |
"" |
environment |
If present, this will be set as |
false |
"" |
resource |
If present, this will be set as |
false |
"" |
no-validate |
If present, this will be set as |
false |
"" |
stackctl-version |
The version of Stackctl to install. Do not include the |
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 |
false |
true |
name | description |
---|---|
tag |
A consistent, source-specific value that should be used throughout build/push/deploy actions. It's currently the head sha for |
cache |
Path to the |
- 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
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.