Skip to content

A collection of Github Actions for interaction with Charmhub, and validating Charmed Operator code

Notifications You must be signed in to change notification settings

canonical/charming-actions

Folders and files

NameName
Last commit message
Last commit date
Dec 7, 2023
Feb 18, 2022
Dec 7, 2023
Feb 8, 2024
Jan 29, 2025
Sep 18, 2024
Dec 7, 2023
Jun 4, 2024
Dec 7, 2023
May 24, 2024
Jan 29, 2025
Dec 8, 2021
Dec 7, 2023
Dec 7, 2023
Jan 29, 2025
Jan 23, 2023
Feb 22, 2022
Feb 18, 2022
Apr 4, 2024
Feb 18, 2022
May 24, 2024
May 28, 2024
Feb 18, 2022

Repository files navigation

Charming Actions Collection

The Charming Actions Collection is a set of actions useful for Juju charm developers who want to introduce automation into their release workflow. The collection currently consists of the following actions:

Usage

⚠️ Prerequisites

To use these actions, start by adding a repository secret to your Github repository. In the example below, it's called CHARMCRAFT_TOKEN, but can be anything you want. See https://juju.is/docs/sdk/remote-env-auth for more information on how to generate the appropriate credentials. GITHUB_TOKEN does not need to be explicitly added to the repository secrets as GitHub Actions will generate a context-bound token for each workflow execution.

The below snippet illustrates how to use the actions of the collection in a PR workflow, as well as a push workflow:

name: Pull Request

on:
  pull_request:
    branches:
      - main

jobs:
  build:
    name: Release to edge
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Check libraries
        uses: canonical/charming-actions/check-libraries@2.2.0
        with:
          credentials: "${{ secrets.CHARMHUB_TOKEN }}"
          github-token: "${{ secrets.GITHUB_TOKEN }}"
name: Release

on:
  push:
    branches:
      - main

jobs:
  build:
    name: Release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Release any bumped charm libs
        uses: canonical/charming-actions/release-libraries@2.2.0
        with:
          credentials: "${{ secrets.CHARMHUB_TOKEN }}"
          github-token: "${{ secrets.GITHUB_TOKEN }}"
      - name: Select charmhub channel
        uses: canonical/charming-actions/channel@2.2.0
        id: channel
      - name: Upload charm to charmhub
        uses: canonical/charming-actions/upload-charm@2.2.0
        with:
          credentials: "${{ secrets.CHARMHUB_TOKEN }}"
          github-token: "${{ secrets.GITHUB_TOKEN }}"
          upload-image: "true"
          channel: "${{ steps.channel.outputs.name }}"

Development

To be able to contribute to this repository, you first need to make sure you have npm and nodejs installed in your local development environment. This installation varies depending on the OS and distribution you are using. For more detailed instructions, see the official NodeJS page.

Once that is done, start by cloning the repository:

$ git clone git@github.com:canonical/charming-actions.git
$ cd charming-actions

Then install the required packages:

$ npm install

Finally, build the actions by running:

$ npm run build

Tests

Run unit tests:

$ npm test