A collection of GitHub Actions for working with Slipstream. A full end-to-end example can be seen on the slipstream-actions-example repository.
See Action definition for additional details.
The push-image
action builds a Docker image and pushes it to an appropriate Google Cloud Registry for use by Kubernetes. Additionally it generates and pushes artifact metadata to Slipstream.
- name: Build and push Docker image
uses: BrandwatchLtd/slipstream-actions/push-image@main
id: push-image
with:
service: myservice
labels: project=myproject
To push images to ECR you need to provide an ECR dockerRegistry
and setup a few environment variables. For your image to be deployable via slipstream it is mandatory to set the release
field to true
otherwise your image will be considered as a development image.
- name: Build and push Docker image
uses: BrandwatchLtd/slipstream-actions/push-image@main
id: push-to-slipstream
with:
service: slipstream-pipeline-visualiser
labels: project=appinfra
dockerRegistry: <your_ecr_docker_registry>
release: true #for image to be deployable via slipstream
env:
#The AWS secrets are already set as organisation level secrets, you don't need
#to set them on a repository level, unless you want to use a different account
AWS_ACCESS_KEY_ID: ${{ secrets.ARTIFACTS_PROD_AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ARTIFACTS_PROD_AWS_SECRET_KEY }}
AWS_DEFAULT_REGION: eu-west-1
See Action definition for additional details.
The push-files
action packages up a directory of files and pushes it to an appropriate Google Cloud Storage bucket for use in static website hosting. Additionally it generates and pushes artifact metadata to Slipstream.
- name: Push static files
uses: BrandwatchLtd/slipstream-actions/push-image@main
id: push-image
with:
service: myservice
filesDir: ./myfiles
stageVersionCheckURL: https://myservice.stage.brandwatch.com/metadata/version
prodVersionCheckURL: https://myservice.brandwatch.com/metadata/version
labels: project=myproject
See Action definition for additional details.
The install-cli
action downloads and installs the Slipstream CLI. Useful for deployment requests, or querying for information about services and artifacts. NB: Requires the gcloud CLI to be installed and configured for authentication.
- uses: BrandwatchLtd/slipstream-actions/install-cli@main
- uses: google-github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.BW_PROD_ARTIFACTS_KEY }}
export_default_credentials: true
The deploy
action can be used to create a deployment request for a given artifact. This is typically used immediately after building an image to request a deployment to stage.
- name: Deploy new image to stage
uses: BrandwatchLtd/slipstream-actions/deploy@main
with:
environment: stage
service: myservice
id: ${{ steps.push-image.outputs.imageDigest }}
See Action definition for additional details.
The maven-build
action build and tag your maven package that will be picked up by your docker build in the target
folder.
- name: Maven build package
uses: BrandwatchLtd/slipstream-actions/maven-build@main
See Action definition for additional details.
The maven-verify
action will verify your maven package and run additional your tests on it.
- name: Maven verify package
uses: BrandwatchLtd/slipstream-actions/maven-verify@main
See Action definition for additional details.
NB: The default branch for this repo is main
.
Each action is in its own /<action>
directory. Shared functionality is in /lib
.
When working on these actions, in the root directory you should run:
npm run dev
This starts a file watcher for each action and rebuilds the <action>/dist/index.js
file for each action. Changes to these should be checked in to git as they are the entry point for each action.
To run all the actions unit tests run:
npm test