Skip to content

Commit

Permalink
Merge pull request #755 from WildernessLabs/develop
Browse files Browse the repository at this point in the history
Add Meadow.Cloud Publisher and Collections section
  • Loading branch information
jorgedevs authored Jun 7, 2024
2 parents 5877cbd + ec63af7 commit d33f0a3
Show file tree
Hide file tree
Showing 33 changed files with 832 additions and 663 deletions.
4 changes: 2 additions & 2 deletions docs/Meadow/Getting_Started/Desktop/Hello_Ft232/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ And as for the FT232H with the RGB LED, you should see something like this:

### Step 6 - Check out additional samples

You can check more samples in our [Meadow.Desktop.Samples](https://github.com/WildernessLabs/Meadow.Desktop.Samples) GitHub repo.
You can check more samples in our [Meadow.Desktop.Samples](https://github.com/WildernessLabs/Meadow.Samples) GitHub repo.

![Meadow.Desktop.Samples GitHub Repository](../../Common_Assets/wildernesslabs-meadow-desktop-samples.jpg)

Expand Down Expand Up @@ -126,7 +126,7 @@ And a WinForm window should show up in the center of the screen saying `Hello, W

### Step 6 - Check out additional samples

You can check more samples in our [Meadow.Desktop.Samples](https://github.com/WildernessLabs/Meadow.Desktop.Samples) GitHub repo.
You can check more samples in our [Meadow.Desktop.Samples](https://github.com/WildernessLabs/Meadow.Samples) GitHub repo.

![Meadow.Desktop.Samples GitHub Repository](../../Common_Assets/wildernesslabs-meadow-desktop-samples.jpg)

Expand Down
4 changes: 2 additions & 2 deletions docs/Meadow/Getting_Started/Desktop/Hello_Simulator/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Right-click the new project and select **Set as Startup project**

### Step 6 - Check out additional samples

You can check more samples in our [Meadow.Desktop.Samples](https://github.com/WildernessLabs/Meadow.Desktop.Samples) GitHub repo.
You can check more samples in our [Meadow.Desktop.Samples](https://github.com/WildernessLabs/Meadow.Samples) GitHub repo.

![Meadow.Desktop.Samples GitHub Repository](../../Common_Assets/wildernesslabs-meadow-desktop-samples.jpg)

Expand Down Expand Up @@ -114,7 +114,7 @@ A WinForm window should show up in the center of the screen saying `Hello, World

### Step 6 - Check out additional samples

You can check more samples in our [Meadow.Desktop.Samples](https://github.com/WildernessLabs/Meadow.Desktop.Samples) GitHub repo.
You can check more samples in our [Meadow.Desktop.Samples](https://github.com/WildernessLabs/Meadow.Samples) GitHub repo.

![Meadow.Desktop.Samples GitHub Repository](../../Common_Assets/wildernesslabs-meadow-desktop-samples.jpg)

Expand Down
40 changes: 0 additions & 40 deletions docs/Meadow/Meadow.Cloud/Automatic_Publish/index.md

This file was deleted.

42 changes: 0 additions & 42 deletions docs/Meadow/Meadow.Cloud/Automatic_Upload/index.md

This file was deleted.

126 changes: 126 additions & 0 deletions docs/Meadow/Meadow.Cloud/CI_CD/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
---
layout: Meadow
title: Publishing with GitHub Actions
sidebar_label: GitHub Actions Publisher
subtitle: Getting started
---

With GitHub Actions, you can automate the complete process of building, uploading and publishing Meadow MPAK files to Meadow.Cloud using [`Meadow.Cloud Package Upload`](https://github.com/marketplace/actions/meadow-cloud-package-upload) and [`Meadow.Cloud Package Publish`](https://github.com/marketplace/actions/meadow-cloud-package-publish) GitHub Actions. It provides an integrated solution for managing the deployment pipeline of Meadow-based applications.

## Ensure your Meadow device receives OTA Updates

Before you continue with this guide, make sure your Meadow application has [over-the-air updates](../OtA_Updates/index.md) enabled. You can also head over to our [Meadow.Samples](https://github.com/WildernessLabs/Meadow.Samples) repo where you can check OTA Update samples under the Meadow.Cloud section.

## Configure a repo with Meadow.Cloud Publisher

### Step 1 - Get a Meadow.Cloud API Key

Login to your Wilderness Labs account in the [Meadow.Cloud](https://www.meadowcloud.co/) site, click on your profile photo and select **Your API Keys**. Once there, create an API Key with **Package scope enabled**, and save it somewhere safe, as you'll need it further down when creating the GitHub Actions workflow script.

![Create API key](wildernesslabs-api-key.jpg)

### Step 2 - Get your Organization and Collection IDs

In your Meadow.Cloud site, go to the **Collections** section and copy the `Collections ID` and keep it somewhere handy.

![Get collection ID](wildernesslabs-collection-id.png)

You'll also need the `Organization ID`. Click on your profile and select **Your Organizations**, and copy the ID value there as well.

![Get organization ID](wildernesslabs-organization-id.png)

### Step 3 - Setting up WiFi config file (if using WiFi connectivity)

:::caution
This guide is using an example thats using a WiFi network connection. If your project is using Ethernet or Cellular to listen for Over-the-Air Updates, you can skip this step and continue on Step 4.
:::

Once you have your hardware and app deployed and connected to a WiFI network to listen for OTA updates, you need to update the `wifi.config.yml` and replace the credentials with GitHub Actions variables:

```yml
# WiFi network credentials
Credentials:

# WiFi SSID
Ssid: {{CONFIG_WIFI_SSID}}

# WiFi Password
Password: {{CONFIG_WIFI_PASS}}
```
That way you dont need to have hard-coded WiFi credentials inside your application. Instead, you can create repository variables, and the **GitHub Actions Publisher** will replace them in the upload pipeline.
### Step 4 - Add Repository Secrets for sensitive data
Create repository secrets to store your sensitive information like WiFi credentials (if you're using WiFi), API Keys, etc. You'll reference them later when writing the GitHub Actions workflow script.
In the repo page, go to the **Settings** tab, look **Secrets and variables** settings under the **Security** section, and enter the repository secrets for your private data such as WiFi credentials, API keys, etc.
![Add WiFi and API Key secrets](wildernesslabs-secrets.jpg)
### Step 5 - Create a GitHub action Workflow
In your repository, add a `.github` folder if you havent already and inside add a `workflows` folder. Finally, create a workflow file, `main.yml` for example. Copy the following code block:

```yml
name: Upload/Publish MPAK
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout F7FeatherDemo
uses: actions/checkout@v3
with:
path: F7FeatherDemo
- name: Build + Upload
uses: WildernessLabs/meadow-cloud-package-upload@main
with:
project_path: "Source/F7FeatherDemo/"
organization_id: "<YOUR ORGANIZATION ID>" # Required, set this to your organization
api_key: ${{ secrets.API_KEY }} # Required, set this to an api key that has package scope
os_version: "1.12.0.0" # Optional, set this to the OS version if required
configs : '{"CONFIG_WIFI_SSID": "${{ secrets.CONFIG_WIFI_SSID }}", "CONFIG_WIFI_PASS": "${{ secrets.CONFIG_WIFI_PASS }}"}' # Optional, set this to a matching token to replaced within your *.yaml files if required
- name: Publish
uses: WildernessLabs/meadow-cloud-package-publish@main
with:
api_key: ${{ secrets.API_KEY }} # Required, set this to an api key that has package scope
collection_id: "<YOUR COLLECTION ID>" # Required, set this to an api key that has package scope
metadata: "metadata part of my publish" # Optional, set this to the desired metadata for publish if required
```

:::info
Things to note:
- You can access secrets variables by doing `${{ secrets.VARIABLE_NAME }}`
- In the `configs` field at the **Build + Upload** step, you can enter a list of repository variables along with values that will be replaced during the build and upload pipeline. In this example guide, we're referencing the SSID and Password variables names that match to the ones given in the `wifi.config.yml` file.
:::

Make sure to paste your ``Organization ID`` and ``Collection ID`` in the corresponding fields.

### Step 6 - Publish an update

If everything is configured properly, you can finally publish app updates from GitHub Actions. Head over to your repo, select the **Actions** tab, and select the workflow you just created. Click the **Run workflow** button to publish an update.

![Publish an update](wildernesslabs-publish.jpg)

### End-To-End Sample Repo

If you're having issues getting your publisher to work, you can refer to our [F7FeatherDemo](https://github.com/WildernessLabs/F7FeatherDemo) repo that has a basic Meadow F7 Feather application with OTA Updates enabled along with the GitHub Action Publisher properly configured.

### Check out other Meadow.Cloud Features

With the automatic publishing configured, check out the other Meadow.Cloud features.

* [Health Monitoring](../Health_Monitoring/)
* [Logs + Events](../Logs_Events/)
* [Command + Control](../Command_Control/)
* [Integrations](../Integrations/)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions docs/Meadow/Meadow.Cloud/Collections/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
layout: Meadow
title: Understanding Collections
sidebar_label: Understanding Collections
---

Meadow.Cloud's method of orchestrating device management across different groups is called **Collections**. When you first create a **Wilderness Labs account**, a `General` Collection is created automatically, and any devices you provision are added to it by default.

## Why use Collections?

When you publish a package to send an Over-the-Air Update, you can specify which group of devices you intend to send the update to. If you have Feather boards, Core-Compute Modules, Project Labs, etc., all under the same Collection, sending an update will send the same package to all these different form factors. If your app is exclusively designed to run on a Project Lab, your Feather boards will try to run the app and throw a wrong hardware exception.

## Creating a Collection

Creating a new Collection is a straightforward process. Head over to the Collections section and click on the **+ New Collection** button, enter a name and your new Collection is added to the table along with a generated ID. You can use this ID to pass as parameter for the device provision command on the Meadow.CLI to add devices specifically to this Collection:

```console
meadow device provision --name "F7 Feather" --collectionId <COLLECTION_ID>
```

## Moving a provisioned device to another collection

If you want to move a device or devices to another collection, head over to your **Devices** section and make sure the Collection filter on the top right is selected to **Showing All**. Select which devices you'd like move to another collection and you'll see a contextual menu appear on the top of the table.

![Select devices](wildernesslabs-collections-select.png)

Click the **Move to Collection** drop down button that will list all your collections, and choose the collection you'd like to move the selected devices.

![Select devices](wildernesslabs-collections-move.png)

Now your devices have moved to another Collection and you can confirm when you change the filter or go to the **Collections** section and click on the **View Devices** button.

## Deleting a Collection

To delete a Collection, you first need to either delete or move those devices to another Collection. Once the Collection is empty, select it to show the contextual menu on top and Click the **Delete** button.

![Delete a collection](wildernesslabs-collections-delete.png)

### Check out other Meadow.Cloud Features

Now that you've learned about Collections, check out the other Meadow.Cloud features.

* [Over-the-Air (OtA) Updates](../OtA_Updates/)
* [Health Monitoring](../Health_Monitoring/)
* [Logs + Events](../Logs_Events/)
* [Command + Control](../Command_Control/)
* [GitHub Actions Publisher](../CI_CD/)
* [Integrations](../Integrations/)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d33f0a3

Please sign in to comment.