Skip to main content

Upsert Shipyard Fleet GitHub Action

This action allows you to upsert (update or insert) a Shipyard fleet configuration based on GitHub events such as commits, pull request openings, or merges.

The way that the action decides to create or update a fleet is based on the id fields within the YAML. If the id exists in the Shipyard project, the fleet will be updated. If the id does not exist, a new fleet will be created. Same goes for the individual vessels within the fleet. For more information on Shipyard Fleet YAMLs, see the Shipyard Fleet YAML Reference.

Overview​

Prerequisites​

Before proceeding, make sure you have completed the prerequisites outlined in the Shipyard GitHub Actions Overview.

Base Shipyard Action Step​

With the Shipyard Action, you can use our pre-built action by referencing it in the uses field of your GitHub Actions workflow file along with providing the necessary inputs via the with field.

name: <workflow-name>
on:
<trigger-event>:
<trigger-conditions>
jobs:
<job-name>:
runs-on: ubuntu-latest
steps:
- <any additional steps if needed>
- name: Checkout Code
uses: actions/checkout@v4
- name: <step-name>
uses: shipyardapp/shipyard-actions/upsert-fleet@v1
with:
org_id: '<organization-id>'
project_id: '<project-id>'
yaml_path: '<path-to-your-fleet-config.yaml>'
shipyard_api_key: '<API_KEY> ideally in the form of ${{ secrets.SHIPYARD_API_KEY }}'

Action Inputs​

The shipyardapp/shipyard-actions/upsert-fleet action has the following inputs:

  • org_id: Your organization ID in Shipyard.
  • project_id: Your project ID in Shipyard.
  • yaml_path: The path to the YAML file defining the fleet configuration.
  • shipyard_api_key: Your Shipyard API key, stored securely in GitHub secrets.

Quick Start​

Here are some examples of how you can configure the Shipyard GitHub Action to upsert a fleet based on different GitHub events. You can copy and paste these configurations into your workflow file and customize them as needed. You are not limited to these examples, and you can create your own configurations based on your requirements.

name: Upsert Shipyard Fleet on Push
on:
push:
branches:
- main

jobs:
upsert-fleet:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Upsert Shipyard Fleet
uses: shipyardapp/shipyard-actions/upsert-fleet@v1
with:
org_id: 'your-organization-id'
project_id: 'your-project-id'
yaml_path: './path-to-your-fleet-config.yaml'
shipyard_api_key: ${{ secrets.SHIPYARD_API_KEY }}